PR20991: ::decltype is not valid.
llvm-svn: 219043
diff --git a/clang/lib/Parse/ParseExprCXX.cpp b/clang/lib/Parse/ParseExprCXX.cpp
index 8f22f56..47fdd82 100644
--- a/clang/lib/Parse/ParseExprCXX.cpp
+++ b/clang/lib/Parse/ParseExprCXX.cpp
@@ -242,7 +242,8 @@
*MayBePseudoDestructor = false;
}
- if (Tok.is(tok::kw_decltype) || Tok.is(tok::annot_decltype)) {
+ if (!HasScopeSpecifier &&
+ (Tok.is(tok::kw_decltype) || Tok.is(tok::annot_decltype))) {
DeclSpec DS(AttrFactory);
SourceLocation DeclLoc = Tok.getLocation();
SourceLocation EndLoc = ParseDecltypeSpecifier(DS);
diff --git a/clang/test/Parser/cxx0x-decl.cpp b/clang/test/Parser/cxx0x-decl.cpp
index 2cd6825..994104f 100644
--- a/clang/test/Parser/cxx0x-decl.cpp
+++ b/clang/test/Parser/cxx0x-decl.cpp
@@ -116,6 +116,11 @@
};
}
+namespace ColonColonDecltype {
+ struct S { struct T {}; };
+ ::decltype(S())::T invalid; // expected-error {{expected unqualified-id}}
+}
+
struct Base { virtual void f() = 0; virtual void g() = 0; virtual void h() = 0; };
struct MemberComponentOrder : Base {
void f() override __asm__("foobar") __attribute__(( )) {}