]> granicus.if.org Git - clang/commitdiff
PR20991: ::decltype is not valid.
authorRichard Smith <richard-llvm@metafoo.co.uk>
Sat, 4 Oct 2014 01:57:39 +0000 (01:57 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Sat, 4 Oct 2014 01:57:39 +0000 (01:57 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219043 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Parse/ParseExprCXX.cpp
test/Parser/cxx0x-decl.cpp

index 8f22f5609e6e56649a3a9442dd3cb76b28a93d6e..47fdd826a5d1dfc9a5abb477ac858d30b25e567f 100644 (file)
@@ -242,7 +242,8 @@ bool Parser::ParseOptionalCXXScopeSpecifier(CXXScopeSpec &SS,
     *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);
index 2cd68252133c0bfffc7b1e701228658522145b01..994104fc9dfbb1601ff23e680651a43ae73063bf 100644 (file)
@@ -116,6 +116,11 @@ namespace DuplicateSpecifier {
   };
 }
 
+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__(( )) {}