This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c++/9311: g++ 3.2.1 - ICE on illegal code using templates and inheritance
- From: Neil dot Ferguson at aepona dot com
- To: gcc-gnats at gcc dot gnu dot org
- Date: 14 Jan 2003 16:42:30 -0000
- Subject: c++/9311: g++ 3.2.1 - ICE on illegal code using templates and inheritance
- Reply-to: Neil dot Ferguson at aepona dot com
>Number: 9311
>Category: c++
>Synopsis: g++ 3.2.1 - ICE on illegal code using templates and inheritance
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: ice-on-illegal-code
>Submitter-Id: net
>Arrival-Date: Tue Jan 14 08:46:01 PST 2003
>Closed-Date:
>Last-Modified:
>Originator: Neil Ferguson
>Release: gcc version 3.2.1
>Organization:
>Environment:
g++ -v:
Reading specs from /users/nf50041/lib/gcc-lib/sparc-sun-solaris2.8/3.2.1/specs
Configured with: ../gcc-3.2.1-original/configure --prefix=/users/nf50041 --with-gnu-as --with-gnu-ld --enable-languages=c,c++
Thread model: posix
gcc version 3.2.1
Also using binutils-2.13.1; uname -a gives:
SunOS waverley 5.8 Generic_108528-13 sun4u sparc SUNW,Ultra-5_10
and the architecture is (Ultra) sparc32.
>Description:
The attached (very small) source file causes an ICE when
compiled. It defines two class templates, A and B, then
tries to define class C as an inner class of B, inheriting
from A. However, the definition of B does not include a
declaration of C.
Deleting the inheritance from A allows the compiler to
correctly output this error:
failure.cxx:17: invalid definition of qualified type `B<T>::C'
failure.cxx:17: `struct B<T>::<anonymous>' does not declare a template type
Uncommenting the declaration of C in B produces legal
code, which the compiler compiles without trouble.
>How-To-Repeat:
Run:
g++ -c failure.cxx
and you should get:
failure.cxx:17: internal error: Segmentation Fault
>Fix:
None known (write legal code :-)
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="failure.cxx"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="failure.cxx"
Ly8gRmFpbHVyZSBjYXNlLiAKCnRlbXBsYXRlPHR5cGVuYW1lIFQ+CmNsYXNzIEEKewoKfTsKCnRl
bXBsYXRlPHR5cGVuYW1lIFQ+IApjbGFzcyBCIAp7CiAgICAvLyBjbGFzcyBDOwp9OyAKCnRlbXBs
YXRlPHR5cGVuYW1lIFQ+CmNsYXNzIEI8VD46OkMgOiBwdWJsaWMgQTxUPiAKewoKfTsgCg==