Article View: gnu.g++.bug
Article #14002.3.3 Template Interface Change/Bug?
From: Nate Osgood
Date: Sat, 23 Jan 1993 02:26
Date: Sat, 23 Jan 1993 02:26
67 lines
2528 bytes
2528 bytes
Hi! I'm a long-time user of g++ and of the g++ template system. I was
quite surprised to find my template code responsible for many error
messages when I upgraded from gcc 2.2 to 2.3.3 (running on a Sun4
under SunOS 4.1.3). I'm confident that the errors result from some
simple language spec change between the two versions of the compiler,
and I'm hoping to be able to modify my code accordingly. I've
condensed the problem down to a minimal example.
The problem concerns a report that there is no constructor present for
a template class in the visible scope. It seems to occur when trying
to pass instances of the template class being complained about.
Here's the code:
template<class Contents> class A
{
public:
A() {}
A(A &t) {}
};
void bar(A<int>);
int foo()
{
A<int> foo;
bar(foo);
}
and here's the associatd compile
g++ -v /usr/tmp/foo.c
Reading specs from /usr/uns/lib/gcc-lib/sun4/2.3.3/specs
gcc version 2.3.3
/usr/uns/lib/gcc-lib/sun4/2.3.3/cpp -lang-c++ -v -iprefix /usr/uns/lib/gcc-lib/sun4/2.2.2/sun4/2.3.3/ -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -Dsparc -Dsun -Dunix -D__sparc__ -D__sun__ -D__unix__ -D__sparc -D__sun -D__unix /usr/tmp/foo.c /usr/tmp/cca13992.i
GNU CPP version 2.3.3 (sparc)
/usr/uns/lib/gcc-lib/sun4/2.3.3/cc1plus /usr/tmp/cca13992.i -quiet -dumpbase foo.cc -version -o /usr/tmp/cca13992.s
GNU C++ version 2.3.3 (sparc) compiled by GNU C version 2.3.3.
/usr/tmp/foo.c: In function `int foo ()':
/usr/tmp/foo.c:16: no constructor named `A' in visible scope
/usr/tmp/foo.c:17: warning: control reaches end of non-void function
Compilation exited abnormally with code 1 at Wed Jan 20 22:54:35
-------------------
any ideas of what i'm missing?
thanks!
nate osgood
--
-------------------------------------------------------------------------------
Nate Osgood | ARPA: hacrat@catfish.lcs.mit.edu
CS Graduate Student |
MIT LCS Room NE43-636 | UUCP: ...!uunet!catfish.lcs.mit.edu!hacrat
Technical Details
Message-ID:
<1993Jan22.153806.11937@mintaka.lcs.mit.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!cis.ohio-state.edu!catfish.lcs.mit.edu!hacratShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!cis.ohio-state.edu!catfish.lcs.mit.edu!hacrat From: hacrat@catfish.lcs.mit.edu (Nate Osgood) Newsgroups: gnu.g++.bug Subject: 2.3.3 Template Interface Change/Bug? Date: 22 Jan 1993 21:26:22 -0500 Organization: MIT Laboratory for Computer Science Lines: 68 Sender: daemon@cis.ohio-state.edu Approved: bug-g++@prep.ai.mit.edu Distribution: gnu Message-ID: <1993Jan22.153806.11937@mintaka.lcs.mit.edu>