summaryrefslogtreecommitdiffstats
path: root/clang/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
commitf5b24e0136d71a884d4a671a3e4803a8b879e31f (patch)
tree75a271be81206a69a2b93354a8b8d53b281dc9b3 /clang/lib/Parse/Parser.cpp
parent0e2b84312f21de416e91691473290a8df86e45c2 (diff)
downloadbcm5719-llvm-f5b24e0136d71a884d4a671a3e4803a8b879e31f.tar.gz
bcm5719-llvm-f5b24e0136d71a884d4a671a3e4803a8b879e31f.zip
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. llvm-svn: 160613
Diffstat (limited to 'clang/lib/Parse/Parser.cpp')
-rw-r--r--clang/lib/Parse/Parser.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/clang/lib/Parse/Parser.cpp b/clang/lib/Parse/Parser.cpp
index e95af054111..760c7bf717a 100644
--- a/clang/lib/Parse/Parser.cpp
+++ b/clang/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"
OpenPOWER on IntegriCloud