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

           Summary: ICE in uses_template_parms, at cp/pt.c:7064
           Product: gcc
           Version: 4.5.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: g...@abeckmann.de


The following piece of invalid code results in an internal compiler error in
4.5.2 and 4.6 while 4.4.6 reports proper errors.

===== 8< =====
template < int >
struct S ;
template < int /* 'typename' fails, too */ >
S < [ ]
===== >8 =====

$ g++-4.5.x -std=c++0x -c ice-uses_template_parms-cp_pt-c-7064.hIM.min.ii
ice-uses_template_parms-cp_pt-c-7064.hIM.min.ii:4:7:
    internal compiler error: in uses_template_parms, at cp/pt.c:7064

$ g++-trunk -std=c++0x -c ice-uses_template_parms-cp_pt-c-7064.hIM.min.ii
ice-uses_template_parms-cp_pt-c-7064.hIM.min.ii:4:7:
    internal compiler error: in uses_template_parms, at cp/pt.c:7111

If I remove -std=c++0x, I get a warning first:
    warning: lambda expressions only available with -std=c++0x or ...
    internal compiler error: in uses_template_parms, at cp/pt.c:7064

$ g++-4.4.x -std=c++0x -c ice-uses_template_parms-cp_pt-c-7064.hIM.min.ii
ice-uses_template_parms-cp_pt-c-7064.hIM.min.ii:4:
    error: an array reference cannot appear in a constant-expression
ice-uses_template_parms-cp_pt-c-7064.hIM.min.ii:4:
    error: template argument 1 is invalid
ice-uses_template_parms-cp_pt-c-7064.hIM.min.ii:4:
    error: expected unqualified-id at end of input

Verbose output from 4.5.2:

$ g++-4.5.x -v -std=c++0x -c ice-uses_template_parms-cp_pt-c-7064.hIM.min.ii
Using built-in specs.
COLLECT_GCC=/opt/software/x86_64/gcc-4.5.x/bin/g++-4.5.x
COLLECT_LTO_WRAPPER=/opt/software/x86_64/gcc-4.5.x/libexec/gcc/x86_64-unknown-linux-gnu/4.5.2/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-4_5-branch/configure
--prefix=/opt/software/x86_64/gcc-4.5.x --program-suffix=-4.5.x
--enable-languages=c,c++ --enable-checking
Thread model: posix
gcc version 4.5.2 20101011 (prerelease) (GCC)
COLLECT_GCC_OPTIONS='-v' '-std=c++0x' '-c' '-shared-libgcc' '-mtune=generic'
'-march=x86-64'

/opt/software/x86_64/gcc-4.5.x/libexec/gcc/x86_64-unknown-linux-gnu/4.5.2/cc1plus
-fpreprocessed ice-uses_template_parms-cp_pt-c-7064.hIM.min.ii -quiet -dumpbase
ice-uses_template_parms-cp_pt-c-7064.hIM.min.ii -mtune=generic -march=x86-64
-auxbase ice-uses_template_parms-cp_pt-c-7064.hIM.min -std=c++0x -version -o
/tmp/cc0RnXAH.s
GNU C++ (GCC) version 4.5.2 20101011 (prerelease) (x86_64-unknown-linux-gnu)
        compiled by GNU C version 4.5.2 20101011 (prerelease), GMP version
4.3.2, MPFR version 3.0.0-p3, MPC version 0.8.2
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
GNU C++ (GCC) version 4.5.2 20101011 (prerelease) (x86_64-unknown-linux-gnu)
        compiled by GNU C version 4.5.2 20101011 (prerelease), GMP version
4.3.2, MPFR version 3.0.0-p3, MPC version 0.8.2
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
Compiler executable checksum: e08c6991e75f2f1fa9ef4bafb4a73eec
ice-uses_template_parms-cp_pt-c-7064.hIM.min.ii:4:7: internal compiler error:
in uses_template_parms, at cp/pt.c:7064
Please submit a full bug report,

Reply via email to