[Bug c++/10939] New: ICE with templated code [Regression form 2.95.3]

theodore.papadopoulo@sophia.inria.fr gcc-bugzilla@gcc.gnu.org
Thu May 22 16:56:00 GMT 2003

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.


           Summary: ICE with templated code [Regression form 2.95.3]
           Product: gcc
           Version: 3.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: theodore.papadopoulo@sophia.inria.fr
                CC: gcc-bugs@gcc.gnu.org,lionel.champalaune@sophia.inria.fr
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu

The following piece of code fails to compile with g++ (versions 3.2.3, 3.3 and
3.4). Those frontends generate an ICE. This is a regression form 2.95.3 which
compiled the code with no problem.

When compiled with g++-3.4, the compiler ICEs with a message (3.4 delivers the
most complete message IMHO):

argos->g++ toto.C
toto.C: In function `int main()':
toto.C:2: internal compiler error: tree check: accessed elt 2 of tree_vec with 
   1 elts in tsubst, at cp/pt.c:6683
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.

If one of the template parameters T1 or T2 is removed or if the method g is made
to make a const T&, then the compiler accepts the code...

The piece of code:

template <typename T1,typename T2>
inline void f(const T1&,const T2&) { }

template <typename T1,typename T2,void F(const T1&,const T2&)>
struct A {
    template <typename T> void g(T& i) { }

int main() {
    int i;
    A<int,int,f> a;

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.

More information about the Gcc-bugs mailing list