Article View: comp.std.c++
Article #2140Re: local type not allowed as template-arg -- why??
From: David Vandevoorde
Date: Fri, 06 Oct 1995 18:55
Date: Fri, 06 Oct 1995 18:55
28 lines
1712 bytes
1712 bytes
>>>>> "MK" == Mumit Khan <khan@xraylith.wisc.edu> writes:
MK> In a recent thread in c.l.c++, James Kanze and Fabrice Clerc just
MK> pointed out to me section 14.8.4 of the DWP which says the following:
MK> =====
MK> 14.8 Template arguments [temp.arg]
MK> 4 Nor is a local type or a type with no linkage name an acceptable tem-
MK> plate-argument. [Example:
MK> void f()
MK> {
MK> struct S { /* ... */ };
MK> X<S,p> x3; // error: local type used as template-argument
MK> }
MK> --end example]
MK> =====
MK> Why is this necessary? Why isn't the template argument S in X<S,p>
MK> simply treated as X<f()::S, p> (or something along these lines)?
I think this is because the point of instantiation is immediately
_before_ the ``enclosing scope for the point of first use'' (see
[temp.point] 14.3.2/1 for exact wording; also /6 and the rest of
that section).
Daveed
---
[ 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:
<VANDEVOD.95Oct6144945@avs.cs.rpi.edu>Path:
arc1-ca.pugleaf.net!in2.uu.net!bounce-backReferences:
<4529o8$1bfa@news.doit.wisc.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!in2.uu.net!bounce-back Date: 06 Oct 95 18:55:42 GMT Approved: fjh@cs.mu.oz.au From: vandevod@cs.rpi.edu (David Vandevoorde) Newsgroups: comp.std.c++ Subject: Re: local type not allowed as template-arg -- why?? X-Original-Date: 06 Oct 1995 18:49:45 GMT Organization: RPI Computer Science Message-ID: <VANDEVOD.95Oct6144945@avs.cs.rpi.edu> References: <4529o8$1bfa@news.doit.wisc.edu> In-Reply-To: khan@xraylith.wisc.edu's message of 06 Oct 95 04:58:29 GMT