8906 – [3.2 regression] segmentation fault when parsing nested-class definition (original) (raw)

| Description Wirawan Purwanto 2002-12-11 16:06:00 UTC Brief: happens in G++ version 3.2 when parsing the definition of a nested class definition, if the "outer" class is a templatized class. This problem is also-reproducible in SunSPARC and Win32's version of GCC 3.2 Release: g++ version 3.2 Environment: Linux (Redhat 7.3) or Windows 2000 (cygwin) or SunSPARC machine (running Solaris) How-To-Repeat: Please take a look at the attachment for more details. It contains a small piece of code to trigger the error. In brief, try to compile the following: template <class _stuff> class CLASS1 { class Nested1 { class Nested2; }; }; template <class _stuff> class CLASS1<_stuff>::Nested1::Nested2 // <--error here!!! { public: int x; }; /* NOTE: it turns out that the same problem occurs if the outermost class is an ordinary class (not templatized) */ Comment 2 Wolfgang Bangerth 2002-12-11 17🔞33 UTC State-Changed-From-To: open->analyzed State-Changed-Why: Confirmed. It used to work until 3.0, but fails with 3.2 and 3.3. Here's the code: --------------------- template class CO { class CI1 { class CI2; }; }; template class CO::CI1::CI2 {}; --------------------- Using my GNU-compiler-collection, I see that this regression has been introduced in the first half of July: ../bin/gcc-2002-06-15 + ../bin/gcc-2002-07-01 + ../bin/gcc-2002-07-15 X ../bin/gcc-2002-08-01 X Comment 3 janis187 2002-12-12 17:40:03 UTC From: Janis Johnson <janis187@us.ibm.com> To: gcc-gnats@gcc.gnu.org, gcc-prs@gcc.gnu.org, wirawan0@softhome.net, gcc-bugs@gcc.gnu.org, nobody@gcc.gnu.org, jason@redhat.com Cc: Subject: Re: c++/8906: [3.2/3.3 regression] segmentation fault when parsing nested-class definition Date: Thu, 12 Dec 2002 17:40:03 -0800 The mainline regression reported in PR c++/8906 showed up starting with this patch, which might merely uncover an existing problem: >2002-07-10 Jason Merrill <jason@redhat.com> > > PR c++/6255 > * decl.c (lookup_name_real): Build a new TYPENAME_TYPE rather than > modifying the old one. I used the small test case that Wolfgang provided. The ICE occurs in the mainline, the 3.2 branch, 3.2.1, 3.2, and 3.1.1, but not 3.1. http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8906 Comment 6 Joe Buck 2003-04-25 20:06:27 UTC State-Changed-From-To: analyzed->closed State-Changed-Why: Fixed for 3.3. | | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | |