This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Internal error from g++
- To: gcc-bugs at gcc dot gnu dot org
- Subject: Internal error from g++
- From: "Kanze, James" <James dot Kanze at Dresdner-Bank dot com>
- Date: Tue, 20 Feb 2001 13:53:13 +0100
I've found another error in g++ version 2.95.2, under Windows NT. The
program's a bit larger, but since it's an internal error, I'll just
let you guys take it from there.
------------output from g++ -v geniter.cc -o geniter -----------
Reading specs from
/Program/Cygnus/cygwin-b20/H-i586-cygwin32/bin/../lib/gcc-lib/i586-cygwin32/
2.95.2/specs
gcc version 2.95.2 19991024 (release)
/Program/Cygnus/cygwin-b20/H-i586-cygwin32/bin/../lib/gcc-lib/i586-cygwin32/
2.95.2/cpp.exe -lang-c++ -v -iprefix
/Program/Cygnus/cygwin-b20/H-i586-cygwin32/bin/../lib/gcc-lib/i586-cygwin32/
2.95.2/ -D__GNUC__=2 -D__GNUG__=2 -D__GNUC_MINOR__=95 -D__cplusplus -Di386
-D_WIN32 -DWINNT -D_X86_=1 -D__STDC__=1
-D__stdcall=__attribute__((__stdcall__))
-D__cdecl=__attribute__((__cdecl__)) -D__declspec(x)=__attribute__((x))
-D__i386__ -D_WIN32 -D__WINNT__ -D_X86_=1 -D__STDC__=1
-D__stdcall=__attribute__((__stdcall__))
-D__cdecl=__attribute__((__cdecl__)) -D__declspec(x)=__attribute__((x))
-D__i386 -D__WINNT -Asystem(winnt) -Acpu(i386) -Amachine(i386)
-D__EXCEPTIONS -remap -Acpu(i386) -Amachine(i386) -Di386 -D__i386 -D__i386__
-Di586 -Dpentium -D__i586 -D__i586__ -D__pentium -D__pentium__
-D__CYGWIN32__ -D__CYGWIN__ geniter.cc c:\tmp/ccSWafqG.ii
GNU CPP version 2.95.2 19991024 (release) (80386, BSD syntax)
#include "..." search starts here:
#include <...> search starts here:
/Program/Cygnus/cygwin-b20/H-i586-cygwin32/bin/../lib/gcc-lib/i586-cygwin32/
2.95.2/../../../../../include/g++-3
/Program/Cygnus/cygwin-b20/H-i586-cygwin32/bin/../lib/gcc-lib/i586-cygwin32/
2.95.2/../../../../../include
/Program/Cygnus/cygwin-b20/H-i586-cygwin32/bin/../lib/gcc-lib/i586-cygwin32/
2.95.2/../../../../i586-cygwin32/include
/Program/Cygnus/cygwin-b20/H-i586-cygwin32/bin/../lib/gcc-lib/i586-cygwin32/
2.95.2/include
End of search list.
The following default directories have been omitted from the search path:
/usr/include
End of omitted list.
/Program/Cygnus/cygwin-b20/H-i586-cygwin32/bin/../lib/gcc-lib/i586-cygwin32/
2.95.2/cc1plus.exe c:\tmp/ccSWafqG.ii -quiet -dumpbase geniter.cc -version
-o c:\tmp/ccmuLyDu.s
GNU C++ version 2.95.2 19991024 (release) (i586-cygwin32) compiled by GNU C
version 2.95.2 19991024 (release).
geniter.cc: In function `void dump(A &)':
geniter.cc:256: Internal compiler error.
geniter.cc:256: Please submit a full bug report.
geniter.cc:256: See <URL:http://www.gnu.org/software/gcc/faq.html#bugreport>
for instructions.
------------output from g++ -v geniter.cc -o geniter -----------
------------geniter.cc--------------
#include <iterator>
#include <string>
#include <list>
#include <deque>
#include <iostream.h>
#include <typeinfo>
// We'll settle for a forward iterator for now...
template< typename Value >
class Iter
{
public:
Iter( Iter const& other ) ;
template< class FwdIter >
Iter( FwdIter const& other ) ;
virtual ~Iter() ;
Iter& operator=( Iter const& other ) ;
void swap( Iter& other ) ;
Iter& operator++() ;
Iter operator++( int ) ;
Value& operator*() const ;
Value* operator->() const ;
bool operator==( Iter const& other ) const ;
bool operator!=( Iter const& other ) const ;
protected:
Iter() ;
virtual void incr() ;
virtual Value* current() const ;
virtual bool isEqual( Iter const& other ) const ;
virtual Iter* clone() const ;
private:
Iter* myImpl ;
} ;
template< typename FwdIter >
class StdIterWrapper
: public Iter< std::iterator_traits< FwdIter >::value_type >
{
public:
typedef Iter< std::iterator_traits< FwdIter >::value_type > Base ;
typedef std::iterator_traits< FwdIter >::value_type Value ;
explicit StdIterWrapper( FwdIter iter ) ;
StdIterWrapper( StdIterWrapper const& other ) ;
protected:
virtual void incr() ;
virtual Value* current() const ;
virtual bool isEqual( Base const& other ) const ;
virtual Base* clone() const ;
private:
StdIterWrapper< FwdIter >&
operator=( StdIterWrapper< FwdIter > const& ) ;
FwdIter myIter ;
} ;
template< typename Value >
Iter< Value >::Iter( Iter const& other )
: myImpl( other.myImpl == 0 ? 0 : other.myImpl->clone() )
{
}
template< typename Value >
template< typename FwdIter >
Iter< Value >::Iter( FwdIter const& other )
: myImpl( new StdIterWrapper< FwdIter >( other ) )
{
}
template< typename Value >
Iter< Value >::~Iter()
{
delete myImpl ;
}
template< typename Value >
Iter< Value >&
Iter< Value >::operator=( Iter< Value > const& other )
{
Iter< Value > tmp( other ) ;
swap( tmp ) ;
return *this ;
}
template< typename Value >
void
Iter< Value >::swap( Iter< Value >& other )
{
std::swap( myImpl , other.myImpl ) ;
}
template< typename Value >
Iter< Value >&
Iter< Value >::operator++()
{
myImpl->incr() ;
return *this ;
}
template< typename Value >
Iter< Value >
Iter< Value >::operator++( int )
{
Iter< Value > tmp( *this ) ;
myImpl->incr() ;
return tmp ;
}
template< typename Value >
Value&
Iter< Value >::operator*() const
{
return *current() ;
}
template< typename Value >
Value*
Iter< Value >::operator->() const
{
return current() ;
}
template< typename Value >
bool
Iter< Value >::operator==( Iter const& other ) const
{
return isEqual( other ) ;
}
template< typename Value >
bool
Iter< Value >::operator!=( Iter const& other ) const
{
return ! isEqual( other ) ;
}
template< typename Value >
Iter< Value >::Iter()
: myImpl( 0 )
{
}
template< typename Value >
void
Iter< Value >::incr()
{
myImpl->incr() ;
}
template< typename Value >
Value*
Iter< Value >::current() const
{
return myImpl->current() ;
}
template< typename Value >
bool
Iter< Value >::isEqual( Iter< Value > const& other ) const
{
return myImpl->isEqual( *other.myImpl ) ;
}
template< typename Value >
Iter< Value >*
Iter< Value >::clone() const
{
return new Iter< Value >( *this ) ;
}
template< typename FwdIter >
StdIterWrapper< FwdIter >::StdIterWrapper( FwdIter iter )
: myIter( iter )
{
}
template< typename FwdIter >
StdIterWrapper< FwdIter >::StdIterWrapper( StdIterWrapper const& other )
: Base( static_cast< Base const& >( other ) )
, myIter( other.myIter )
{
}
template< typename FwdIter >
void
StdIterWrapper< FwdIter >::incr()
{
++ myIter ;
}
template< typename FwdIter >
StdIterWrapper< FwdIter >::Value*
StdIterWrapper< FwdIter >::current() const
{
return &*myIter ;
}
template< typename FwdIter >
bool
StdIterWrapper< FwdIter >::isEqual( Iter< Value > const& other ) const
{
StdIterWrapper< FwdIter > const* typedOther
= dynamic_cast< StdIterWrapper< FwdIter > const* >( &other ) ;
return typedOther == 0
? false
: myIter == typedOther->myIter ;
}
template< typename FwdIter >
StdIterWrapper< FwdIter >::Base*
StdIterWrapper< FwdIter >::clone() const
{
return new StdIterWrapper< FwdIter >( *this ) ;
}
//====================================================================
typedef Iter< std::string > iter ;
struct A
{
virtual iter begin() = 0 ;
virtual iter end() = 0 ;
} ;
struct B : A {
std::list< std::string > s ;
virtual iter begin() {
return s.begin() ;
}
virtual iter end() {
return s.end() ;
}
} ;
struct C : A {
std::deque< std::string > s ;
virtual iter begin() {
return s.begin() ;
}
virtual iter end() {
return s.end() ;
}
} ;
void
dump( A& obj )
{
std::copy( obj.begin() , obj.end() ,
std::ostream_iterator( std::cout , '\n' ) ) ;
// for ( iter i = obj.begin() ; i != obj.end() ; ++ i ) {
// cout << *i << endl ;
// }
}
int
main()
{
B b ;
b.s.push_back( "abc" ) ;
b.s.push_back( "xyz" ) ;
b.s.push_back( "123" ) ;
b.s.push_back( "def" ) ;
dump( b ) ;
C c ;
c.s.push_back( "abc" ) ;
c.s.push_back( "xyz" ) ;
c.s.push_back( "123" ) ;
c.s.push_back( "def" ) ;
dump( c ) ;
return 0 ;
}
------------geniter.cc--------------
--
James Kanze mailto:kanze@gabi-soft.de
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
Ziegelhüttenweg 17a, 60598 Frankfurt, Germany Tel. +49(069)63198627