http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52315
Bug #: 52315 Summary: [C++11] constexpr object of nested class Classification: Unclassified Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: oleg.e...@t-online.de I'm not sure whether this is valid/invalid C++11, but it seems a little weird. The following works as expected: struct B { constexpr B (unsigned v) noexcept : val (v) { } constexpr unsigned value (void) const noexcept { return val; } unsigned val; }; struct A { int stuff[B (16).value ()]; }; But moving struct B inside of struct A ... struct A { struct B { constexpr B (unsigned v) noexcept : val (v) { } constexpr unsigned value (void) const noexcept { return val; } unsigned val; }; int stuff[ B (16).value () ]; }; ... results in error: size of array 'stuff' is not an integral constant-expression Using built-in specs. COLLECT_GCC=sh-elf-gcc COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/sh-elf/4.7.0/lto-wrapper Target: sh-elf Configured with: ../gcc-trunk/configure --target=sh-elf --prefix=/usr/local --enable-languages=c,c++ --enable-multilib --disable-libssp --disable-nls --disable-werror --enable-lto --with-newlib --with-gnu-as --with-gnu-ld --with-system-zlib Thread model: single gcc version 4.7.0 20120220 (experimental) (GCC)