Article View: gnu.gcc.help
Article #52464problems with template classes: part 3
From: Stefano Casadei
Date: Thu, 16 Jul 1992 00:47
Date: Thu, 16 Jul 1992 00:47
47 lines
1542 bytes
1542 bytes
Here is the "riddle" for today:
Consider the following file:
//************************* file.cc
template <class Type>
class Array {
public:
Array() { }
Array(const Array &iA) { } //*** tricky line
};
template <class Type>
class image {
public:
image() { }
protected:
Array<Type> data;
};
main()
{
image<double> da;
image<double> du=da; // KO line
}
//******************* end of file.cc
With the tricky line commented out, the gnu compiler 2.2.2
(on IPC with OS 4.1.1) works fine. Otherwise, the above file
yields the following message (in correspondence of the KO line):
file.cc: In function `int main ()':
file.cc:21: no member function `Array<double>::Array<double>'
Note: I don't think the error is due to the slimness of the class definition.
This file is just an excerpt of a "real" piece of code which gave the same
error message.
Once again, your help will be appreciated.
Thanks.
Technical Details
Message-ID:
<1992Jul16.004733.4511@athena.mit.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!verona.mit.edu!casadeiShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 11318c,982b1b8294611ea3,start X-Google-Attributes: gid11318c,public X-Google-ArrivalTime: 1992-07-15 16:41:14 PST Newsgroups: gnu.gcc.help Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!verona.mit.edu!casadei From: casadei@verona.mit.edu (Stefano Casadei) Subject: problems with template classes: part 3 Message-ID: <1992Jul16.004733.4511@athena.mit.edu> Sender: gnulists@ai.mit.edu Organization: Massachusetts Institute of Technology Distribution: gnu Date: Thu, 16 Jul 1992 00:47:33 GMT Lines: 49