C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Puzzle(About dependent-type)

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ Language (Moderated)
View previous topic :: View next topic  
Author Message
ppLiu_china
Guest





PostPosted: Mon Dec 15, 2003 10:24 am    Post subject: Puzzle(About dependent-type) Reply with quote



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! ]
Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ Language (Moderated) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.