With the following piece of code: ============================== struct integer { int i; };
struct foo1 { double d; int i; }; struct foo2 { double d; integer i; }; int main(int argc, char **argv) { int i1 = 0; integer i2{0}; foo1 f1{3.2, i1}; //ok new foo1{3.2, i1}; //ok foo2 f2{3.2, i2}; //ok new foo2{3.2, i2}; //error, why? return 0; } ============================== GCC 4.4 svn (4.4.0 20081005) can't compile "new foo2{...}" line: ============================== $ g++ -std=c++0x main.cpp main.cpp: In function 'int main(int, char**)': main.cpp:53: error: could not convert '{3.20000000000000017763568394002504646778106689453e+0, i2}' to 'foo2' ============================== though the other lines are OK. I didn't see anything about a difference between the two forms in the standard, so I guess it is a GCC bug. $ g++ -v Using built-in specs. Target: i686-pc-linux-gnu Configured with: ../gcc/configure --enable-languages='c c++' --disable-nls : (reconfigured) ../gcc/configure --enable-languages='c c++' : (reconfigured) ../gcc/configure --enable-languages='c c++' --enable-shared --disable-static --disable-nls Thread model: posix gcc version 4.4.0 20081005 (experimental) (GCC) -- Summary: [C++0x] "foo f{...}" form compiles, but "new foo{...}" one doesn't Product: gcc Version: 4.4.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: florian dot goujeon at wanadoo dot fr GCC build triplet: i686-pc-linux-gnu GCC host triplet: i686-pc-linux-gnu GCC target triplet: i686-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37740