Topic: [Correction] Name lookup for a template parameter and a base class
Author: "Michael Kochetkov" <Michael.Kochetkov@trustworks.commmm>
Date: Tue, 10 Apr 2001 14:46:11 GMT Raw View
[The note for moderator: while copy/pasting I have lost the template
instantiation code which might lead to obscurity of the example. Please,
consider this post as a correction to the previous "Name lookup for a
template parameter and a base class" thread]
Let us consider the following code:
[Example:
class A {
public:
enum {i};
};
template <class T>
class C : private T {
class B {
public:
B() {T::i;} // AAAA
} b;
};
int
main()
{
C<A> c;
}
-- end example]
The majority of compilers treat T at AAAA as a name of the type which is
defined by the template parameter rather then the base class name. No doubt
it change the semantics a little: the program is well-formed in the first
case and ill-formed in the second one.
Please, give me a reference at the Standard which will clarify this issue. I
failed to do it by myself.
Thank you in advance,
with regards,
Michael Kochetkov.
P.S. I think that 14.6.2/3 and /4 are not applicable because they say about
class template itself and about its members.
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html ]