public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/41510]  New: C++0x std::complex vs. initialization lists
@ 2009-09-30  1:47 bkoz at gcc dot gnu dot org
  2009-09-30  1:48 ` [Bug libstdc++/41510] " bkoz at gcc dot gnu dot org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: bkoz at gcc dot gnu dot org @ 2009-09-30  1:47 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 3873 bytes --]

Here is a sketch of what C++0x std::complex might look like. Minus, of course,
constexpr. Also included in the patch is a testfile that does the usual
init_list tests on std::complex overloads.

It fails to compile, with ambiguous overloads. As so:

%$bld/H-x86-gcc.20090927/bin/g++ -std=gnu++0x -g -O2
testsuite/26_numerics/complex/complex_init.cc 
testsuite/26_numerics/complex/complex_init.cc: In function ‘void
check_copy_list_initialization() [with _Tp = float]’:
testsuite/26_numerics/complex/complex_init.cc:33:41:   instantiated from here
testsuite/26_numerics/complex/complex_init.cc:18:42: error: call of overloaded
‘complex(<brace-enclosed initializer list>)’ is ambiguous
/mnt/disk/dolores/mnt/share/bld/H-x86-gcc.20090927/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.5.0/../../../../include/c++/4.5.0/complex:1458:3:
note: candidates are: std::complex<float>::complex(const std::complex<long
double>&)
/mnt/disk/dolores/mnt/share/bld/H-x86-gcc.20090927/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.5.0/../../../../include/c++/4.5.0/complex:1454:3:
note:                 std::complex<float>::complex(const std::complex<double>&)
/mnt/disk/dolores/mnt/share/bld/H-x86-gcc.20090927/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.5.0/../../../../include/c++/4.5.0/complex:1020:5:
note:                 std::complex<float>::complex(const std::complex<float>&)
testsuite/26_numerics/complex/complex_init.cc: In function ‘void
check_copy_list_initialization() [with _Tp = double]’:
testsuite/26_numerics/complex/complex_init.cc:34:42:   instantiated from here
testsuite/26_numerics/complex/complex_init.cc:18:42: error: call of overloaded
‘complex(<brace-enclosed initializer list>)’ is ambiguous
/mnt/disk/dolores/mnt/share/bld/H-x86-gcc.20090927/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.5.0/../../../../include/c++/4.5.0/complex:1462:3:
note: candidates are: std::complex<double>::complex(const std::complex<long
double>&)
/mnt/disk/dolores/mnt/share/bld/H-x86-gcc.20090927/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.5.0/../../../../include/c++/4.5.0/complex:1176:7:
note:                 std::complex<double>::complex(const std::complex<float>&)
/mnt/disk/dolores/mnt/share/bld/H-x86-gcc.20090927/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.5.0/../../../../include/c++/4.5.0/complex:1164:5:
note:                 std::complex<double>::complex(const
std::complex<double>&)
testsuite/26_numerics/complex/complex_init.cc: In function ‘void
check_copy_list_initialization() [with _Tp = long double]’:
testsuite/26_numerics/complex/complex_init.cc:35:47:   instantiated from here
testsuite/26_numerics/complex/complex_init.cc:18:42: error: call of overloaded
‘complex(<brace-enclosed initializer list>)’ is ambiguous
/mnt/disk/dolores/mnt/share/bld/H-x86-gcc.20090927/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.5.0/../../../../include/c++/4.5.0/complex:1324:7:
note: candidates are: std::complex<long double>::complex(const
std::complex<double>&)
/mnt/disk/dolores/mnt/share/bld/H-x86-gcc.20090927/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.5.0/../../../../include/c++/4.5.0/complex:1321:7:
note:                 std::complex<long double>::complex(const
std::complex<float>&)
/mnt/disk/dolores/mnt/share/bld/H-x86-gcc.20090927/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.5.0/../../../../include/c++/4.5.0/complex:1309:5:
note:                 std::complex<long double>::complex(const
std::complex<long double>&)


It's hard to tell w/o the constexpr overloads in. Thoughts?

-benjamin


-- 
           Summary: C++0x std::complex vs. initialization lists
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: bkoz at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41510


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2010-05-24 20:33 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-30  1:47 [Bug libstdc++/41510] New: C++0x std::complex vs. initialization lists bkoz at gcc dot gnu dot org
2009-09-30  1:48 ` [Bug libstdc++/41510] " bkoz at gcc dot gnu dot org
2010-05-22  8:07 ` [Bug libstdc++/41510] [C++0x] " paolo dot carlini at oracle dot com
2010-05-22 15:32 ` gdr at cs dot tamu dot edu
2010-05-22 20:22 ` paolo dot carlini at oracle dot com
2010-05-23  2:13 ` [Bug c++/41510] " jason at gcc dot gnu dot org
2010-05-23  9:28 ` paolo dot carlini at oracle dot com
2010-05-24 18:38 ` jason at gcc dot gnu dot org
2010-05-24 20:33 ` jason at gcc dot gnu dot org
2010-05-24 20:33 ` jason at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).