🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

g++ problem with virtual const method in template

#1268
From: yb
Date: Tue, 15 Dec 1992 21:06
55 lines
2552 bytes
g++ 2.3.2 failed to compiled this file :

------------------------------------------------------
template <class T> class A {
public:
virtual	void foo () const;
};

template <class T> void A<T> :: foo () const {}

template <class T> class B : public A<T> {
public:
	void foo () const;
	void bar () { foo(); }
};

B<int> b;
--------------------------------------------------------

The bug disappear when 'const' or 'virtual' is removed.

Here is what happens :

sun2->gcc -v -c bug.cc
Reading specs from /usr/local/gnu/lib/gcc-lib/sun4/2.3.2/specs
gcc version 2.3.2
 /usr/local/gnu/lib/gcc-lib/sun4/2.3.2/cpp -lang-c++ -v -undef
-D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -Dsparc -Dsun -Dunix
-D__sparc__ -D__sun__ -D__unix__ -D__sparc -D__sun -D__unix test.cc
/usr/tmp/cca04703.i
GNU CPP version 2.3.2 (sparc)
 /usr/local/gnu/lib/gcc-lib/sun4/2.3.2/cc1plus /usr/tmp/cca04703.i
-quiet -dumpbase test.cc -version -o /usr/tmp/cca04703.s
GNU C++ version 2.3.2 (sparc) compiled by GNU C version 2.3.2.
test.cc: In method `void  B<int>::bar ()':
test.cc:12: Internal compiler error.
test.cc:12: Please report this to `bug-g++@prep.ai.mit.edu'.
sun2->


+--------------------------+------------------------------------+
|                          |       E-mail : yb@lri.lri.fr       |
|     Yves Berteaud        |                yb@FRLRI61.BITNET   |
|                          |                                    |
|       +-=-+-=-+          |       Voice :  33 (1) 69-41-69-10  |
|                          |       Fax   :  33 (1) 69-41-65-86  |
+--------------------------+------------------------------------+
|      ######      **                                           |
|     ##     #         Laboratoire de recherche en informatique |
|    ##       #   ##   Batiment 490                             |
|   ##       #   ##    Universite de Paris-Sud                  |
|  ##    ####   ##     91405 ORSAY Cedex                        |
| ######    ## ##      FRANCE                                   |
|######      ###                                                |
+---------------------------------------------------------------+
Technical Details
Message-ID: <199212151906.AA22863@lri.lri.fr>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!lri.FR!yb

Show Full Headers
Complete Article Headers
Newsgroups: gnu.g++.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!lri.FR!yb
From: yb@lri.FR
Subject: g++ problem with virtual const method in template
Message-ID: <199212151906.AA22863@lri.lri.fr>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Tue, 15 Dec 1992 21:06:43 GMT
Approved: bug-g++@prep.ai.mit.edu
Lines: 56