aboutsummaryrefslogtreecommitdiff
path: root/lib/Parse/Parser.cpp
diff options
context:
space:
mode:
authorFrancois Pichet <pichet2000@gmail.com>2012-07-22 15:10:57 +0000
committerFrancois Pichet <pichet2000@gmail.com>2012-07-22 15:10:57 +0000
commitb67e7fc607671ef3df64de63c38545197e9992b2 (patch)
treefdb9fba17a784766875f8eff390c769f15a2f9c1 /lib/Parse/Parser.cpp
parentdfd110ce5e64077ec94df195233e7a39895bf15e (diff)
Allow the parser to recover gracefully if a typename is used to introduce a decltype type.
In Microsoft mode, we emit a warning instead of an error. This fixes a couple of errors when parsing the MSVC 11 RC headers with clang. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160613 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/Parser.cpp')
-rw-r--r--lib/Parse/Parser.cpp8
1 files changed, 5 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"