🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.g++.bug
Article #1214

Nested Classes Problem

#1214
From: Alan Teague
Date: Tue, 17 Nov 1992 02:55
29 lines
1393 bytes
The following code causes the compile to crash.  If it doesn't cause your
compiler to crash also, then please let me know so that I can check the 
installation and building of the one here.

Under g++ 1.40.3 this code generates the error message:
	multiple `::' terms in declarator invalid
But I could work around it by dropping the "enclose::" part of the
destructor definition.  I can't figure out how to work around this
problem.  Defining the function in the definition would work only for
very limited functions (non-recursive etc.).

// Compiled with: g++ nested-classes.cc
// Compiler: gcc 2.3.1
// sparc-sun-sunos4.1
// SPARCstation 2 running 4.1.1
//
// Example drawn from page 187 ARM
class enclose {
  class inner {
   public:
    ~inner();
  };
};

// Causes cc1plus to get fatal signal 11 - segmentation violation
enclose::inner::~inner()
{
  x = 0;
}
Technical Details
Message-ID: <9211170255.AA08964@stc.lockheed.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!iggy.GW.Vitalink.COM!cs.widener.edu!umn.edu!spool.mu.edu!caen!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!stc.lockheed.COM!teague

Show Full Headers
Complete Article Headers
Newsgroups: gnu.g++.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!iggy.GW.Vitalink.COM!cs.widener.edu!umn.edu!spool.mu.edu!caen!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!stc.lockheed.COM!teague
From: teague@stc.lockheed.COM (Alan Teague)
Subject: Nested Classes Problem
Message-ID: <9211170255.AA08964@stc.lockheed.com>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Tue, 17 Nov 1992 02:55:00 GMT
Approved: bug-g++@prep.ai.mit.edu
Lines: 30