Article View: gnu.g++.bug
Article #864More info on cc1plus crash
From: Barry A. Warsaw
Date: Mon, 31 Aug 1992 20:59
Date: Mon, 31 Aug 1992 20:59
69 lines
1694 bytes
1694 bytes
I have more information on my previously reported cc1plus bug. Seems
that typedefs nested inside a class cause the problem. Compile the
following simplified example with -DNESTEDTYPEDEF to recreate the bug.
Compile w/o the switch to generate a working program. Sun C++ 2.1
correctly compiles with or w/o the switch.
In the case of -DNESTEDTYPEDEF, the symbol DoIt should be scoped to
class Bar. I.e. its name should be Bar::DoIt.
FTR, I'm using gcc 2.2.2, Sun SS2, SunOS 4.1.1.
-Barry
-------------------- snip snip --------------------
#include <iostream.h>
class Foo
{
public:
Foo()
{};
int do_1( void )
{
cout << "do_1" << endl;
return( 1 );
};
int do_2( void )
{
cout << "do_2" << endl;
return( 2 );
};
};
#ifndef NESTEDTYPEDEF
typedef int (Foo::*DoIt)( void );
#endif
class Bar
{
public:
#ifdef NESTEDTYPEDEF
typedef int (Foo::*DoIt)( void );
#endif
Bar( Foo* fooptr, DoIt doitfunc )
: xfooptr(fooptr), xdoit(doitfunc)
{};
int doit( void )
{
return( (xfooptr->*xdoit)() );
};
private:
Foo* xfooptr;
DoIt xdoit;
};
int main( int, char** )
{
Foo f1;
Bar b1( &f1, &Foo::do_1 );
return( b1.doit() );
};
Technical Details
Message-ID:
<WARSAW.92Aug31155921@anthem.nlm.nih.gov>Path:
arc1-ca.pugleaf.net!sparky!uunet!usc!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!nlm.NIh.GOV!warsawShow Full Headers
Complete Article Headers
Newsgroups: gnu.g++.bug Path: arc1-ca.pugleaf.net!sparky!uunet!usc!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!nlm.NIh.GOV!warsaw From: warsaw@nlm.NIh.GOV (Barry A. Warsaw) Subject: More info on cc1plus crash Message-ID: <WARSAW.92Aug31155921@anthem.nlm.nih.gov> Sender: gnulists@ai.mit.edu Reply-To: warsaw@nlm.nih.gov (Barry A. Warsaw) Organization: Century Computing, Inc. Distribution: gnu Date: Mon, 31 Aug 1992 20:59:20 GMT Approved: bug-g++@prep.ai.mit.edu Lines: 70