This is GCC Bugzilla
This is GCC Bugzilla Version 2.20+
View Bug Activity | Format For Printing | Clone This Bug
Brief: <Segmentation fault> 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) */
Fix: Fixed in GCC 3.3 with: http://gcc.gnu.org/ml/gcc-patches/2003-02/msg01856.html
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 T> class CO { class CI1 { class CI2; }; }; template <class T> class CO<T>::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
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
From: Jeffrey Oldham <oldham@codesourcery.com> To: gcc-gnats@gcc.gnu.org, gcc-prs@gcc.gnu.org, wirawan0@softhome.net, gcc-bugs@gcc.gnu.org Cc: Subject: Re: c++/8906: [3.2/3.3/3.4 regression] segmentation fault when parsing nested-class definition Date: Fri, 10 Jan 2003 11:20:36 -0800 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8906 This problem has been resolved for gcc 3.4, i.e., the CVS head version. It remains open for gcc 3.3. Jeffrey D. Oldham oldham@codesourcery.com
From: Volker Reichelt <reichelt@igpm.rwth-aachen.de> To: gcc-gnats@gcc.gnu.org, gcc-bugs@gcc.gnu.org, wirawan0@softhome.net Cc: Subject: Re: c++/8906: [3.2 regression] segmentation fault when parsing nested-class definition Date: Mon, 10 Mar 2003 12:55:19 +0100 (CET) Just for the record: The problem seems to be fixed on the 3.3 branch (as well as on mainline). It just remains open on the 3.2 branch. Regards, Volker http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8906
State-Changed-From-To: analyzed->closed State-Changed-Why: Fixed for 3.3.