This follows on from this question on stackoverflow.com: http://stackoverflow.com/questions/9894406/initializing-a-const-instance-member-array This has been tested on three versions of GCC (4.7, 4.6.3 and 4.5) on a variety of systems. Output from 4.5 and 4.6.3 are both: http://ideone.com/h7K7y Output from 4.7 is slightly different: http://pastie.org/3679616 Latter includes preprocessed output, using The following: $ gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.6/lto-wrapper Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Debian 4.6.3-1' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++,go --prefix=/usr --program-suffix=-4.6 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-plugin --enable-objc-gc --with-arch-32=i586 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 4.6.3 (Debian 4.6.3-1)
A shorter reproducer has been shown here: https://gist.github.com/2220810 This does not actually have the template parameters inside the braces.
To wit: void foo() { new int[1] {1}; } template<int A> void goo() { new int[1] {1}; } int main() { foo(); goo<1>(); }
This is fixed in 4.8.1
Author: paolo Date: Wed Aug 12 17:18:14 2015 New Revision: 226824 URL: https://gcc.gnu.org/viewcvs?rev=226824&root=gcc&view=rev Log: 2015-08-12 Paolo Carlini <paolo.carlini@oracle.com> PR c++/52742 * g++.dg/cpp0x/pr52742.C: New. Added: trunk/gcc/testsuite/g++.dg/cpp0x/pr52742.C Modified: trunk/gcc/testsuite/ChangeLog
Closing.