By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,640 Members | 1,557 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,640 IT Pros & Developers. It's quick & easy.

Implicit typename, typedefs, and inheritance

P: n/a
Hi all,
I'm working on migrating my code from KCC to gcc, and I'm having some
issues with "implicit typename" warnings from gcc. Essentially, what
happens is described by this example:

template <typename cell_data_type> class cell {};

template <typename a> class c1 {
public:
typedef cell<a> T_cell;
};

template <typename a> class c2 : public c1<a> {
T_cell func();
};

Trying to compile this code, results in this message from gcc:

[40]patrik@rumba:/u/patrik/sunrise/src% g++ -c typename.cc
typename.cc:9: warning: `typename c2<a>::T_cell' is implicitly a
typename
typename.cc:9: warning: implicit typename is deprecated, please see the

documentation for details

I don't understand what is implicit about this type. It's not implicit
in class c1, so how come it's implicit in class c2? The problem is not
correctable by adding typename to the offending line; this results in a
compilation error. Redefining the typedef in c2 removes the warning,
but that makes the idea of public typedefs useless...

Does this behavior makes sense to people?

Thanks,

/Patrik

Jul 23 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
lutorm wrote:
typename.cc:9: warning: implicit typename is deprecated, please see the documentation for details

I don't understand what is implicit about this type. It's not implicit in class c1, so how come it's implicit in class c2? The problem is not correctable by adding typename to the offending line; this results in a compilation error. Redefining the typedef in c2 removes the warning,
but that makes the idea of public typedefs useless...

Does this behavior makes sense to people?


You need to add 'typename' to dependent names. See here for details:
http://womble.decadentplace.org.uk/c...disambiguation
Read also the other FAQs or you get another bunch of errors with the
next gcc release (you probably havn't compiled yet with 3.4).

R.C.

Jul 23 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.