This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
gcc is right to reject this code, something more standard compliant should pass :
for(typename B::iterator i; ...)
a.cpp:29: error: dependent-name ` B::iterator' is parsed as a non-type,
but instantiation yields a type
a.cpp:29: note: say `typename B::iterator' if a type is meantBut still I don't get why this is wrong. Is only because the compiler can't tell whether it's a typename or something else at parse time?
btw, take care with "parent<std::list<int>>". Apparently GCC now gets it right, but to be portable, better write "parent<std::list<int> >", to avoid parsing a shift operator instead.
Cheers, jlh
Attachment:
signature.asc
Description: OpenPGP digital signature
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |