[PATCH] Parser: support Microsoft syntax for 'typename typedef'

Reid Kleckner rnk at google.com
Tue Sep 3 13:26:17 PDT 2013


  Sounds fine, but I'd like to hear Richard's opinion on this hack.


================
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;
----------------
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++.

================
Comment at: lib/Parse/Parser.cpp:1496
@@ +1495,3 @@
+      Tok = TypenameToken;
+      bool Result = TryAnnotateTypeOrScopeToken(EnteringContext, NeedType);
+      PP.EnterToken(Tok);
----------------
What happens with this?
  typename typedef typename typedef T::type type;


http://llvm-reviews.chandlerc.com/D1433



More information about the cfe-commits mailing list