Article View: gnu.g++.bug
Article #1127Failed assertion in g++ 2.3.1
From: Jason Merrill
Date: Tue, 10 Nov 1992 06:08
Date: Tue, 10 Nov 1992 06:08
38 lines
1771 bytes
1771 bytes
The code below produces this output from g++ 2.3.1, compiled for the
Sequent Symmetry and GAS:
g++ -V 2.3.1 test.cc
test.cc:10: inconsistent return types for method `extendable_array' in class `extendable_array<int>'
../cp-decl.c:9961: failed assertion `current_class_decl != NULL_TREE && TREE_CODE (current_class_decl) == PARM_DECL'
/usr/local/gnu/bin/gcc: Internal compiler error: program cc1plus got fatal signal 4
It looks to me like these are two separate but related bugs; removing the
code for the destructor eliminates the failed assertion, but removing the
constructor and adding a null definition for it in the class declaration
allows the program to compile happily.
template <class T> class extendable_array
{
public:
extendable_array(int);
~extendable_array();
protected:
void error_termination(char *msg);
T *array;
int current_size;
};
template <class T> extendable_array<T>::extendable_array(int initial_size)
{
if( initial_size < 1 )
error_termination("improper extendable_array initial size");
array = new T[initial_size];
current_size = initial_size;
}
template <class T> extendable_array<T>::~extendable_array()
{ delete [] array; }
extendable_array<int> e(10);
main() {}
Technical Details
Message-ID:
<1992Nov10.060800.12752@muddcs.claremont.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!stanford.edu!agate!ames!saimiri.primate.wisc.edu!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!jarthur.claremont.edu!jasonShow Full Headers
Complete Article Headers
Newsgroups: gnu.g++.bug Path: arc1-ca.pugleaf.net!sparky!uunet!stanford.edu!agate!ames!saimiri.primate.wisc.edu!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!jarthur.claremont.edu!jason From: jason@jarthur.claremont.edu (Jason Merrill) Subject: Failed assertion in g++ 2.3.1 Message-ID: <1992Nov10.060800.12752@muddcs.claremont.edu> Sender: gnulists@ai.mit.edu Organization: Harvey Mudd College, Claremont, CA 91711 Distribution: gnu Date: Tue, 10 Nov 1992 06:08:00 GMT Approved: bug-g++@prep.ai.mit.edu Lines: 39