typedef vs. typename confusion
Joe Buck
jbuck@synopsys.com
Tue Aug 4 12:19:00 GMT 1998
> There was a related posting two or three weeks ago. It was argued
> that egcs, unilaterally, supplies the keyword 'typename' where needed
> --or more accurately, where he thinks he could do so without transmuting
> programs. I strongly objected against such *default* behaviour. I hope
> this report will be enough convincing to supply the standard
> behaviour, by *default*.
Rigorous enforcement of the "typename" rule will break a lot of old code.
(It was great fun the first time I attempted to port some template-heavy
code to HP's aC++, which takes a very anal-retentive approach to standards
conformance, which is OK if you actually manage to implement the standard
correctly but there were many goofs).
It's best to break old code in stages: first provide a warning, and then
later the warning becomes an error.
That is, whereever the compiler is in effect inserting "typename" (or,
to be more correct, where the compiler is assuming that a name refers
to a type, even though by the strict ISO C++ rules it should not), it
should issue a warning. This warning should have its own flag but be
turned on by -Wall.
(Of course, this is for future work, not for egcs-1.1, which is feature-
frozen).
More information about the Gcc
mailing list