diff options
-rw-r--r-- | lib/Parse/Parser.cpp | 8 | ||||
-rw-r--r-- | test/SemaCXX/MicrosoftCompatibility.cpp | 2 |
2 files changed, 7 insertions, 3 deletions
diff --git a/lib/Parse/Parser.cpp b/lib/Parse/Parser.cpp index e95af05411..760c7bf717 100644 --- a/lib/Parse/Parser.cpp +++ b/lib/Parse/Parser.cpp @@ -1334,10 +1334,12 @@ bool Parser::TryAnnotateTypeOrScopeToken(bool EnteringContext, bool NeedType) { 0, /*IsTypename*/true)) return true; if (!SS.isSet()) { - if (Tok.is(tok::identifier) || Tok.is(tok::annot_template_id)) { + if (Tok.is(tok::identifier) || Tok.is(tok::annot_template_id) || + Tok.is(tok::annot_decltype)) { // Attempt to recover by skipping the invalid 'typename' - if (!TryAnnotateTypeOrScopeToken(EnteringContext, NeedType) && - Tok.isAnnotation()) { + if (Tok.is(tok::annot_decltype) || + (!TryAnnotateTypeOrScopeToken(EnteringContext, NeedType) && + Tok.isAnnotation())) { unsigned DiagID = diag::err_expected_qualified_after_typename; // MS compatibility: MSVC permits using known types with typename. // e.g. "typedef typename T* pointer_type" diff --git a/test/SemaCXX/MicrosoftCompatibility.cpp b/test/SemaCXX/MicrosoftCompatibility.cpp index 74d54ef994..6a48f36801 100644 --- a/test/SemaCXX/MicrosoftCompatibility.cpp +++ b/test/SemaCXX/MicrosoftCompatibility.cpp @@ -4,6 +4,8 @@ typedef unsigned short char16_t; typedef unsigned int char32_t; +typename decltype(3) a; // expected-warning {{expected a qualified name after 'typename'}} + namespace ms_conversion_rules { void f(float a); |