[Bug c++/28341] New: [4.0/4.1/4.2 regression] ICE with references as template parameters

reichelt at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Tue Jul 11 13:43:00 GMT 2006


The following (IMHO invalid) code snippet triggers an ICE since GCC 4.0.0:

=========================================
template<const int&> struct A {};

template<typename T> struct B
{
  A<T(0)> a;
};

B<const int&> b;
=========================================

bug.cc: In instantiation of 'B<const int&>':
bug.cc:8:   instantiated from here
bug.cc:5: internal compiler error: tree check: expected tree that contains
'decl minimal' structure, have 'indirect_ref'  in decl_linkage, at
cp/tree.c:2191
Please submit a full bug report, [etc.]

Before GCC 4.0.0 the following (not too helpful, if not bogus) error
message was issued:

bug.cc: In instantiation of `B<const int&>':
bug.cc:8:   instantiated from here
bug.cc:5: error: `0' is not a valid template argument


-- 
           Summary: [4.0/4.1/4.2 regression] ICE with references as template
                    parameters
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Keywords: ice-on-invalid-code, monitored
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: reichelt at gcc dot gnu dot org


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



More information about the Gcc-bugs mailing list