Article View: gnu.g++.bug
Article #115Template classes and incomplete classes
From: James Woodyatt
Date: Wed, 08 Apr 1992 02:50
Date: Wed, 08 Apr 1992 02:50
71 lines
2433 bytes
2433 bytes
The following code causes gcc-2.1's cc1plus to die and dump core inside
globalize_nested_type(). I'm trying to grok the code, but have so far
failed.
The code I've written here might be invalid, but I'm not sure -- no
one's answered my question about it on comp.std.c++ yet, and I couldn't
find anything in Stroustrup that said that I'm doing something patently
illegal...
My setup:
./configure sun4
non-standard directory tree
Michael Tiemann's patch to cp-cvt.c to fix infinite loop
in type converision to reference.
Here is the code:
//-------------------------- foo.cc ---------------------------
template<class T>
class Foo
{
public:
typedef void (T::*Method)();
Method method;
void foo() { (*method)(); }
Foo(Method m) : method(m) { }
};
class Bar
{
public:
static Foo<Bar> foo;
void alpha() { }
void beta() { }
};
Bar::foo(&Bar::alpha);
int main()
{
Foo f;
f.foo();
return 0;
}
//-------------------------- End of foo.cc ---------------------------------
Here is the compiler invocation:
g++ -v -O -Wall -Wno-implicit -fpcc-struct-return -I. -I/p2/proj.istc/src/h -c foo.cc
Reading specs from /share2/projects/proj.gnu/sun4/lib/gcc-lib/sun4/2.1/specs
gcc version 2.1
/share2/projects/proj.gnu/sun4/lib/gcc-lib/sun4/2.1/cpp -lang-c++ -v -I. -I/p2/proj.istc/src/h -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -Dsparc -Dsun -Dunix -D__sparc__ -D__sun__ -D__unix__ -D__sparc -D__sun -D__unix -D__OPTIMIZE__ -Wall -Wno-implicit foo.cc /usr/tmp/cca01590.i
GNU CPP version 2.1 (sparc)
/share2/projects/proj.gnu/sun4/lib/gcc-lib/sun4/2.1/cc1plus /usr/tmp/cca01590.i -quiet -dumpbase foo.cc -O -Wall -Wno-implicit -version -fpcc-struct-return -o /usr/tmp/cca01590.s
GNU C++ version 2.1 (sparc) compiled by GNU C version 2.1.
NFS server kazoo not responding still trying
/share2/projects/proj.gnu/sun4/bin/gcc: Internal compiler error: program cc1plus got fatal signal 11
Technical Details
Message-ID:
<9204080250.AA01728@cutter.ssd.loral.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!cutter.ssd.loral.com!bardShow Full Headers
Complete Article Headers
Newsgroups: gnu.g++.bug Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!cutter.ssd.loral.com!bard From: bard@cutter.ssd.loral.com (James Woodyatt) Subject: Template classes and incomplete classes Message-ID: <9204080250.AA01728@cutter.ssd.loral.com> Sender: gnulists@ai.mit.edu Organization: GNUs Not Usenet Distribution: gnu Date: Wed, 8 Apr 1992 02:50:24 GMT Approved: bug-g++@prep.ai.mit.edu Lines: 72