🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Incorrect error and fatal signal with g++-2.3.1 on sparcs

#1135
From: Cliff Krumvieda
Date: Tue, 10 Nov 1992 08:50
86 lines
2680 bytes
Howdy:

We're running g++-2.3.1 on sparcs and SunOS 4.1.1; g++ is producing
some strange output on the two programs below.

######################################################################
######################################################################

bug.C:
======================================================================
#include <stream.h>

template<class T> 
class X{
  T ick;
public:
  X(T j){ ick = j;}
  X(X& x){ ick = x.ick;}
  T get(){ return ick; };
};

void zook ( X<char> y) {
  cout << y.get() << "\n";
}

main () {
  X<char> xc('a');
  zook(xc);
}
======================================================================

Compiling yields:

======================================================================
[~/bug/samuel] gnu% g++ -v
Reading specs from /usr/local/gnu/gcc-2.3.1/lib/gcc-lib/sparc-sun-sunos4.1/2.3.1/specs
gcc version 2.3.1
[~/bug/samuel] gnu% g++ bug.C
bug.C: In function `int  main ()':
bug.C:18: no constructor named `X' in visible scope
[~/bug/samuel] gnu%
======================================================================

However, it appears to me that X is in line 18's scope; indeed, AT&T's
CC compiler has no problem with bug.C.

######################################################################
######################################################################

bug2.C:
======================================================================
#include <stream.h>

template<class T> 
class X{
  T ick;
public:
  X(T j){ ick = j;}
  X(X& x){ ick = x.ick;}
  T get(){ return ick; };
};

template<class T>
void zook ( X y) {
  cout << y.get() << "\n";
}

main () {
  X<char> xc('a');
  zook(xc);
}
======================================================================

Compiling yields:

======================================================================

[~/bug/samuel] gnu% g++ bug2.C
bug2.C:13: parse error before `)'
/usr/local/gnu/bin/gcc: Internal compiler error: program cc1plus got fatal signal 11
[~/bug/samuel] gnu%
======================================================================

Thanks.

						--Cliff Krumvieda
Technical Details
Message-ID: <9211101850.AA15597@ask.cs.cornell.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!stanford.edu!ames!saimiri.primate.wisc.edu!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!cs.cornell.edu!cliff

Show Full Headers
Complete Article Headers
Newsgroups: gnu.g++.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!stanford.edu!ames!saimiri.primate.wisc.edu!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!cs.cornell.edu!cliff
From: cliff@cs.cornell.edu (Cliff Krumvieda)
Subject: Incorrect error and fatal signal with g++-2.3.1 on sparcs
Message-ID: <9211101850.AA15597@ask.cs.cornell.edu>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Tue, 10 Nov 1992 08:50:15 GMT
Approved: bug-g++@prep.ai.mit.edu
Lines: 87