http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49924
Summary: [C++0X] [constexpr] can't initialize a non-static member array of a literal type as a constexpr Product: gcc Version: 4.6.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: fais...@yahoo.com I believe the following code should compile: struct A { constexpr A() { } }; struct B { A array[1]; //non-static member array of a literal type w constexpr ctor constexpr B() : array{} { } // here is the problem }; int main() { constexpr B b{}; // won't compile } But i get the following output with g++4.6.1: <output> In function 'int main()': <file>.cpp:11:17: error: '{{{A()}}}' is not a constant expression </output> FYI, the following does compile: int main() { constexpr A a[1]{}; } Thanks! p.s My gcc -v output is: Using built-in specs. COLLECT_GCC=g++-4.6.1 COLLECT_LTO_WRAPPER=/usr/local/gcc4.6.1/libexec/gcc/i686-pc-linux-gnu/4.6.1/lto-wrapper Target: i686-pc-linux-gnu Configured with: ../gcc-4.6.1/configure --prefix=/usr/local/gcc4.6.1 --enable-generated-files-in-srcdir --enable-threads=posix --with-system-zlib --enable-__cxa_atexit --disable-checking --disable-nls --enable-bootstrap --with-gcc --with-gnu-as --with-gnu-ld --disable-multilib Thread model: posix gcc version 4.6.1 (GCC)