The following program gives an internal compiler error, when built with the command line: g++ -std=c++11 main.cpp //--------------------------------------------------- template <typename T, decltype(sizeof(T)) N> auto array_size(T(&)[N]) -> decltype(N) { return N; } int main() { int simple[4] = {}; int result = array_size(simple); return result; } //--------------------------------------------------- The error I get from my build of gcc is: main.cpp: In function 'int main()': main.cpp:1:38: internal compiler error: in dependent_type_p, at cp/pt.c:19249 template <typename T, decltype(sizeof(T)) N> ^ main.cpp:1:38: internal compiler error: Abort trap: 6 g++-mp-4.8: internal compiler error: Abort trap: 6 (program cc1plus) Abort trap: 6 Build is a recent version obtained from MacPorts, running on the latest Apple Mountain Lion OS with up to date patches. g++ -v: Using built-in specs. COLLECT_GCC=g++-mp-4.8 COLLECT_LTO_WRAPPER=/opt/local/libexec/gcc/x86_64-apple-darwin12/4.8.0/lto-wrapper Target: x86_64-apple-darwin12 Configured with: ../gcc-4.8-20121125/configure --prefix=/opt/local --build=x86_64-apple-darwin12 --enable-languages=c,c++,objc,obj-c++,fortran,java --libdir=/opt/local/lib/gcc48 --includedir=/opt/local/include/gcc48 --infodir=/opt/local/share/info --mandir=/opt/local/share/man --datarootdir=/opt/local/share/gcc-4.8 --with-local-prefix=/opt/local --with-system-zlib --disable-nls --program-suffix=-mp-4.8 --with-gxx-include-dir=/opt/local/include/gcc48/c++/ --with-gmp=/opt/local --with-mpfr=/opt/local --with-mpc=/opt/local --with-ppl=/opt/local --with-cloog=/opt/local --enable-cloog-backend=isl --disable-cloog-version-check --enable-stage1-checking --disable-multilib --enable-lto --enable-libstdcxx-time --with-as=/opt/local/bin/as --with-ld=/opt/local/bin/ld --with-ar=/opt/local/bin/ar --with-bugurl=https://trac.macports.org/newticket --with-pkgversion='MacPorts gcc48 4.8-20121125_0' Thread model: posix gcc version 4.8.0 20121125 (experimental) (MacPorts gcc48 4.8-20121125_0)
Seems a regression.
HJ, can you find when we regressed on this?
It is caused by revision 190830: http://gcc.gnu.org/ml/gcc-cvs/2012-08/msg00809.html
Are you kidding? This is a front-end issue and happens also at -O0.
(In reply to comment #3) > It is caused by revision 190830: > > http://gcc.gnu.org/ml/gcc-cvs/2012-08/msg00809.html Oops. Right revision, wrong link: http://gcc.gnu.org/ml/gcc-cvs/2012-08/msg00808.html
Thanks.
Author: jason Date: Thu Dec 6 14:36:55 2012 New Revision: 194248 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=194248 Log: PR c++/55564 * pt.c (unify) [ARRAY_TYPE]: Unify the element type before the bounds. Added: trunk/gcc/testsuite/g++.dg/cpp0x/decltype47.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/pt.c
Fixed.