Topic: template names
Author: jason@cygnus.com (Jason Merrill)
Date: 1996/02/16 Raw View
Does this passage:
14.2.1 Locally declared names [temp.local]
1 Within the scope of a class template or a specialization of a template
the name of the template is equivalent to the name of the template
followed by the template-parameters enclosed in <>. [Example: the
constructor for Set can be referred to as Set() or Set<T>(). ]
make this testcase well-formed?
template <class T> struct A {};
template <class T> struct B
: public A<B> // use of B without parms
{ A* ap; }; // use of A without parms
How about this?
template <class T> struct A {
A::A::A* p;
};
What is "the scope of a class template"? Judging from
9 Classes [class]
2 A class-name is inserted into the scope in which it is declared imme-
diately after the class-name is seen. The class-name is also inserted
into the scope of the class itself. For purposes of access checking,
the inserted class name is treated as if it were a public member name.
I would say that A<B> above is ill-formed, and the others are well-formed.
Agree?
Jason
---
[ comp.std.c++ is moderated. Submission address: std-c++@ncar.ucar.edu.
Contact address: std-c++-request@ncar.ucar.edu. The moderation policy is
in http://reality.sgi.com/employees/austern_mti/std-c++/policy.html. ]