summaryrefslogtreecommitdiffstats
path: root/lib/Parse
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2019-02-26 02:22:17 +0000
committerReid Kleckner <rnk@google.com>2019-02-26 02:22:17 +0000
commit4983a66562c8bf3d0ccf042fc42dd9a30e7c2420 (patch)
treec051ce69333bc4100922c98624738028f972fad7 /lib/Parse
parent8208fdc13b5f759269c31db14c7662ecea4e804c (diff)
[MS] Fix for Bug 8446, template instantiation without a 'typename' keyword
Patch by Zahira Ammarguellat! Differential Revision: https://reviews.llvm.org/D41950 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@354838 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse')
-rw-r--r--lib/Parse/ParseTentative.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/Parse/ParseTentative.cpp b/lib/Parse/ParseTentative.cpp
index b2cd0bd0d3..11f1aeb76f 100644
--- a/lib/Parse/ParseTentative.cpp
+++ b/lib/Parse/ParseTentative.cpp
@@ -1498,6 +1498,17 @@ Parser::isCXXDeclarationSpecifier(Parser::TPResult BracedCastResult,
// expression.
*HasMissingTypename = true;
return TPResult::Ambiguous;
+ } else {
+ // In MS mode, if HasMissingTypename is not provided, and the tokens
+ // are or the form *) or &) *> or &> &&>, this can't be an expression.
+ // The typename must be missing.
+ if (getLangOpts().MSVCCompat) {
+ if (((Tok.is(tok::amp) || Tok.is(tok::star)) &&
+ (NextToken().is(tok::r_paren) ||
+ NextToken().is(tok::greater))) ||
+ (Tok.is(tok::ampamp) && NextToken().is(tok::greater)))
+ return TPResult::True;
+ }
}
} else {
// Try to resolve the name. If it doesn't exist, assume it was