🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #2700

Dependency through template use

#2700
From: Marc Girod
Date: Thu, 23 Nov 1995 15:32
39 lines
2028 bytes
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. ]
Technical Details
Message-ID: <GIROD.95Nov23152417@dshp01.trs.ntc.nokia.com>
Path: arc1-ca.pugleaf.net!engnews1.Eng.Sun.COM!taumet!clamage

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!engnews1.Eng.Sun.COM!taumet!clamage
From: girod@dshp01.trs.ntc.nokia.com (Marc Girod)
Newsgroups: comp.std.c++
Subject: Dependency through template use
Date: 23 Nov 1995 15:32:28 GMT
Organization: Nokia Telecommunications - Network & Access Systems
Approved: clamage@eng.sun.com (comp.std.c++)
Distribution: world
Message-ID: <GIROD.95Nov23152417@dshp01.trs.ntc.nokia.com>
Reply-To: Marc Girod <girod@trshp.trs.ntc.nokia.com>
NNTP-Posting-Host: taumet.eng.sun.com
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Nntp-Posting-Host: dshp01.trs.ntc.nokia.com
X-Attribution: MG
Content-Length: 1074
Originator: clamage@taumet