aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Parse/ParseTentative.cpp
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
commit2bc58bd06dc4aeb2f10fb3bf56a69583b4ebf212 (patch)
tree532077a8783e9fcda229c22fc0750e809147864e /clang/lib/Parse/ParseTentative.cpp
parent2f055f026ad76f3503c7c40c40f4b71594adbe55 (diff)
downloadllvm-2bc58bd06dc4aeb2f10fb3bf56a69583b4ebf212.zip
llvm-2bc58bd06dc4aeb2f10fb3bf56a69583b4ebf212.tar.gz
llvm-2bc58bd06dc4aeb2f10fb3bf56a69583b4ebf212.tar.bz2
[MS] Fix for Bug 8446, template instantiation without a 'typename' keyword
Patch by Zahira Ammarguellat! Differential Revision: https://reviews.llvm.org/D41950 llvm-svn: 354838
Diffstat (limited to 'clang/lib/Parse/ParseTentative.cpp')
-rw-r--r--clang/lib/Parse/ParseTentative.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/clang/lib/Parse/ParseTentative.cpp b/clang/lib/Parse/ParseTentative.cpp
index b2cd0bd0..11f1aeb 100644
--- a/clang/lib/Parse/ParseTentative.cpp
+++ b/clang/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