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)
Let's CC Jason...
Subject: Bug 37740 Author: jason Date: Fri Nov 14 20:50:59 2008 New Revision: 141865 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=141865 Log: PR c++/37740 * call.c (build_aggr_conv): Increment i. Added: trunk/gcc/testsuite/g++.dg/cpp0x/initlist8.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/call.c trunk/gcc/testsuite/ChangeLog
Fixed.