typedef of template<T> x to member x in template class

S

squarewave

Hi,

I was recently alerted by a user of an error reported by gcc 4.3.3,
when I typedef a previously defined template struct X as a member type with same name X
to remove the template parameters:

template<class T1, class T2, class T3>
struct Helper
{ /*...*/ };


template<class T1>
class MyClass
{
typedef Helper<T1, std::string, int> Helper; // gcc error
//typedef ::Helper ...etc would be accepted
};

gcc reports "error: changes meaning of 'Helper' from ..."

Questions:
- Is the gcc error correct? I guess so, but what's the relevant part of standard?
is Helper<T...> a dependent name, so covered by 14.6.2 - and Comeau's "pseudo-instantiation" doesn't get there...?)

- Is Comeau incorrect, or does the error arise in some later stage than provided by the online compiler?

Thanks for any help!


(I'd like to write C++, but tool support is dodgy.
- No MSVC version cuts it, so I run gcc 3.4 to get a second opinion,
and occasionally paste code and drop into Comeau online to get the sage view.
I'm a little worried if Comeau doesn't agree here, then I'm stumped.
I gather that gcc 4.x has not been ported to Windows)

Jocke
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,740
Latest member
JudsonFrie

Latest Threads

Top