ppLiu_china Guest
|
Posted: Mon Dec 15, 2003 10:24 am Post subject: Puzzle(About dependent-type) |
|
|
C++ 98: 14.6.2.1 - Dependent types
....
A type is dependent if it is
— a template parameter,
— a qualified-id with a nested-name-specifier which contains a
classname --#1
that names a dependent type or whose unqualified-id names a dependent
type,
....
Note #1!
It says that something like this:
D<T>::someType
is a dependent type,because it contains a nested-name-specifier
"D<T>::",which contains a classname "D<T>" that names a dependent
type!
So consider the following codes:
template<typename T>
class B
{
public:
typedef char XType;
};
template<typename T>
class D:public B<T>
{
public:
typename D<T>::XType member; #2
};
At #2,with /Za option on,VC7.1 gives me an error!(/Za option makes
VC7.1 more consistent with standard)
Isn't D<T>::XType a dependent type that should be resolved at
instantiation point?
More surprisingly,when I move /Za option away,VC7.1 let #2 go!
What I think is,with /Za which makes VC7.1 more consistent with
Standard,VC7.1 should let #2 go!
Who can give me an answer?
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|