Bug 31516 - ICE on nested templates
Summary: ICE on nested templates
Status: RESOLVED DUPLICATE of bug 33035
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.3.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-checking, ice-on-valid-code, monitored
Depends on:
Blocks:
 
Reported: 2007-04-09 21:19 UTC by Volker Reichelt
Modified: 2007-08-15 15:25 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2007-04-10 00:30:53


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Volker Reichelt 2007-04-09 21:19:35 UTC
The following valid code snippet triggers an ICE since at least GCC 2.95.3:

=================================
template<int> struct A
{
  template<int> struct B
  {
    template<int> void foo()
    {
      struct C { C() {} };
    }
  };
};
=================================

bug.cc: In member function 'void A<<anonymous> >::B<<anonymous> >::foo()':
bug.cc:7: internal compiler error: tree check: expected class 'type', have 'declaration' (function_decl) in push_template_decl_real, at cp/pt.c:3857
Please submit a full bug report, [etc.]
Comment 1 Wolfgang Bangerth 2007-04-10 00:30:53 UTC
Confirmed, though this appears to work up to and including the 4.1.2
release at least, in contrast to your assertion...

W.
Comment 2 Volker Reichelt 2007-04-10 01:22:53 UTC
Well, it crashes for me:

GCC 2.95.3:
PR31516.cc: In method `A<{anon}>::B<{anon}>::foo()::C::C()':
PR31516.cc:7: ../../../gcc-2.95.3/gcc/cp/pt.c:2493: Expect 't', have 'function_decl'

GCC 3.0.4:
PR31516.cc: In member function `void A<<anonymous> >::B<<anonymous> >::foo()':
PR31516.cc:7: Tree check: expected class 't', have 'd' (function_decl) in 
   push_template_decl_real, at cp/pt.c:2687
Please submit a full bug report, [etc.]

GCC 3.2.3:
PR31516.cc: In member function `void A<<anonymous> >::B<<anonymous> >::foo()':
PR31516.cc:7: tree check: expected class 't', have 'd' (function_decl) in 
   push_template_decl_real, at cp/pt.c:2776
Please submit a full bug report, [etc.]

GCC 3.3.6:
PR31516.cc: In member function `void A<<anonymous> >::B<<anonymous> >::foo()':
PR31516.cc:7: internal compiler error: tree check: expected class 't', have 'd' 
   (function_decl) in push_template_decl_real, at cp/pt.c:2897
Please submit a full bug report, [etc.]

Maybe you don't have checking enabled for the release versions?
Comment 3 Wolfgang Bangerth 2007-04-10 19:18:15 UTC
(In reply to comment #2)

> Maybe you don't have checking enabled for the release versions?

That appears to be the case (I thought I had set --enable-checking).

In any case, I see the ICE on the currently maintained release branches,
which is what counts anyway :-)

W.

Comment 4 Paolo Carlini 2007-08-15 15:25:31 UTC
This is a duplicate of 33035 and indeed the latter isn't a regression, I'm fixing that.

*** This bug has been marked as a duplicate of 33035 ***