🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Bug with templates and copy constructors

#30
From: Stephane Chatty
Date: Tue, 03 Nov 1992 12:39
34 lines
1625 bytes
// g++ 2.3.1 is wrong when detecting error in the following code.
// It seems to have problem to locate the copy constructor
// of the template class.

template <class T> class Vector {
public:
	Vector (T&);
	Vector (Vector&); // no error when this line is removed
};

class A {
public:
	int a;
};

typedef Vector <A> AVector;

extern void bar (AVector);

void
foo (AVector& v)
{
	bar (v);
}

// % g++ -v -c foo.cc
// Reading specs from /usr/local/lib/gcc-lib/sun4/2.3.1/specs
// gcc version 2.3.1
//  /usr/local/lib/gcc-lib/sun4/2.3.1/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 foo.cc /usr/tmp/cca02245.i
// GNU CPP version 2.3.1 (sparc)
//  /usr/local/lib/gcc-lib/sun4/2.3.1/cc1plus /usr/tmp/cca02245.i -quiet -dumpbase foo.cc -version -o /usr/tmp/cca02245.s
// GNU C++ version 2.3.1 (sparc) compiled by GNU C version 2.3.1.
// foo.cc: In function `void  foo (class Vector<A>&)':
// foo.cc:23: no constructor named `Vector' in visible scope
Technical Details
Message-ID: <9211031039.AA03233@geant.cenatls.cena.dgac.fr>
Path: arc1-ca.pugleaf.net!sparky!uunet!news.encore.com!csar!foxtail!sdd.hp.com!wupost!cs.utexas.edu!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!cis.ohio-state.edu!geant.cenatls.cena.dgac.fr!chatty

Show Full Headers
Complete Article Headers
Newsgroups: gnu.g++.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!news.encore.com!csar!foxtail!sdd.hp.com!wupost!cs.utexas.edu!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!cis.ohio-state.edu!geant.cenatls.cena.dgac.fr!chatty
From: chatty@geant.cenatls.cena.dgac.fr (Stephane Chatty)
Subject: Bug with templates and copy constructors
Message-ID: <9211031039.AA03233@geant.cenatls.cena.dgac.fr>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Tue, 3 Nov 1992 12:39:01 GMT
Approved: bug-g++@prep.ai.mit.edu
Lines: 35