Topic: Dependency through template use
Author: girod@dshp01.trs.ntc.nokia.com (Marc Girod)
Date: 1995/11/23 Raw View
Hello!
I compile the following example:
--------------------------------
template <class T> class X {
T t_;
};
class Y;
class Z {
X<Y>* x_;
};
--------------------------------
and get an error from my compiler:
CC: "foo.C", line 2: error: Y undefined, size not known (1437)
"foo.C", line 2: error detected during the instantiation of X <Y>
"foo.C", line 8: is the site of the instantiation
Could you confirm that my compiler is wrong, and should not require
that I #include the definition of type Y.
I could not find the answer in the draft (I looked in chapter
14.2...).
Thanks!
--
+---------------------------------------------------------------------------+
| Marc Girod - Nokia Telecommunications Phone: +358-0-511 27703 |
| Kilo RD 4 - P.O. Box 12 Fax: +358-0-511 27432 |
| SF-02611 Espoo 61 - Finland Internet: marc.girod@ntc.nokia.com |
| X.400: C=FI, A=Elisa, P=Nokia Telecom, SUR=Girod, GIV=Marc |
+---------------------------------------------------------------------------+
[ comp.std.c++ is moderated. Submission address: std-c++@ncar.ucar.edu.
Contact address: std-c++-request@ncar.ucar.edu. The moderation policy
is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]