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 

typename pour sous classes

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ (French)
View previous topic :: View next topic  
Author Message
Loïc Joly
Guest





PostPosted: Thu May 12, 2005 6:50 pm    Post subject: typename pour sous classes Reply with quote



Bonjour à tous,

J'ai un problème pour compiler le code suivant sous VC8 beta 1 :

template <class T, class U>
struct B
{};

template <class T>
struct A : public B <T, typename T::subtype::subtype> // ligne 7
{
};

struct T1
{
typedef int subtype;
};

struct T2
{
typedef T1 subtype;
};

int main()
{
A<T2> a; // ligne 23
};


Si je remplace
struct A : public B <T, typename T::subtype::subtype>
par
struct A : public B <T, typename T::subtype>

Là, il veut bien compiler.

Est-ce un problème dans le code, ou bien dans le compilo ?



Pour info, les messages d'erreur :

TestTemplate.cpp(7) : error C2143: syntax error : missing ',' before
'T1::{ctor}'
TestTemplate.cpp(23) : see reference to class template instantiation
'A<T>' being compiled
with
[
T=T2
]
TestTemplate.cpp(7) : error C2976: 'B' : too few template arguments
TestTemplate.cpp(4) : see declaration of 'B'
TestTemplate.cpp(Cool : error C2955: 'B' : use of class template requires
template argument list
TestTemplate.cpp(4) : see declaration of 'B'
TestTemplate.cpp(23) : error C2512: 'A<T>' : no appropriate default
constructor available
with
[
T=T2
]

--
Loïc
Back to top
Jean-Marc Bourguet
Guest





PostPosted: Thu May 12, 2005 7:09 pm    Post subject: Re: typename pour sous classes Reply with quote



Loïc Joly <loic.actarus.joly (AT) wanadoo (DOT) fr> writes:

Quote:
Est-ce un problème dans le code, ou bien dans le compilo ?

Ni como 4.3.3, ni icc 8.1, ni g++ 4.0 ne se plaignent et
j'ai l'impression qu'ils ont raison.

A+

--
Jean-Marc
FAQ de fclc++: http://www.cmla.ens-cachan.fr/~dosreis/C++/FAQ
C++ FAQ Lite en VF: http://www.ifrance.com/jlecomte/c++/c++-faq-lite/index.html
Site de usenet-fr: http://www.usenet-fr.news.eu.org

Back to top
Cyrille
Guest





PostPosted: Thu May 12, 2005 8:25 pm    Post subject: Re: typename pour sous classes Reply with quote



Jean-Marc Bourguet a écrit :
Quote:
Loïc Joly <loic.actarus.joly (AT) wanadoo (DOT) fr> writes:


Est-ce un problème dans le code, ou bien dans le compilo ?


Ni como 4.3.3, ni icc 8.1, ni g++ 4.0 ne se plaignent

La beta 2 de VC8 compile aussi sans rechigner. Un bug de la beta 1 qui a
été corrigé, sans doute.

Quote:
j'ai l'impression qu'ils ont raison.

itou.

--
win the yes need the no to win against the no!

Back to top
Loïc Joly
Guest





PostPosted: Thu May 12, 2005 8:43 pm    Post subject: Re: typename pour sous classes Reply with quote

Cyrille a écrit :
Quote:
Jean-Marc Bourguet a écrit :

Loïc Joly <loic.actarus.joly (AT) wanadoo (DOT) fr> writes:


Est-ce un problème dans le code, ou bien dans le compilo ?



Ni como 4.3.3, ni icc 8.1, ni g++ 4.0 ne se plaignent


La beta 2 de VC8 compile aussi sans rechigner. Un bug de la beta 1 qui a
été corrigé, sans doute.

Merci, je viens d'installer la béta 2, et ça marche effectivement !

--
Loïc


Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ (French) 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.