http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55564



             Bug #: 55564

           Summary: internal error using decltype of a template type

                    parameter for late-specified function result type

    Classification: Unclassified

           Product: gcc

           Version: 4.8.0

            Status: UNCONFIRMED

          Severity: normal

          Priority: P3

         Component: c++

        AssignedTo: unassig...@gcc.gnu.org

        ReportedBy: pub...@alisdairm.net





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)

Reply via email to