[PATCH] Parser: support Microsoft syntax for 'typename typedef'
Richard Smith
richard at metafoo.co.uk
Tue Sep 3 13:46:54 PDT 2013
================
Comment at: lib/Parse/Parser.cpp:1489
@@ +1488,3 @@
+ // typename T_::D typedef D;
+ if (getLangOpts().MicrosoftExt && NextToken().is(tok::kw_typedef)) {
+ Token TypenameToken = Tok;
----------------
Reid Kleckner wrote:
> I believe this is more of a MicrosoftMode feature. -fms-extensions covers extensions like declspecs, and -fms-compatibility is the kitchen sink of invalid C++.
I'm inclined to agree. While this is a conforming extension (and thus satisfies the requirements for MicrosoftExt), it's pretty heinous, and looks like a bug not an extension.
================
Comment at: lib/Parse/Parser.cpp:1490-1495
@@ +1489,8 @@
+ if (getLangOpts().MicrosoftExt && NextToken().is(tok::kw_typedef)) {
+ Token TypenameToken = Tok;
+ ConsumeToken();
+ Token TypedefToken = Tok;
+ ConsumeToken();
+ PP.EnterToken(Tok);
+ Tok = TypenameToken;
+ bool Result = TryAnnotateTypeOrScopeToken(EnteringContext, NeedType);
----------------
Maybe replace these lines with just
Token TypedefToken;
PP.Lex(TypedefToken);
http://llvm-reviews.chandlerc.com/D1433
More information about the cfe-commits
mailing list