]> granicus.if.org Git - clang/commitdiff
'constexpr' and 'friend' are both declaration specifiers. Teach the parser this,...
authorRichard Smith <richard-llvm@metafoo.co.uk>
Thu, 25 Oct 2012 00:00:53 +0000 (00:00 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Thu, 25 Oct 2012 00:00:53 +0000 (00:00 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166645 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Parse/ParseDecl.cpp
test/Parser/recovery.cpp

index 26175a50f53fe543d730c33713d13382456f3c53..bb5f333749904bccc7b9441ac3d05edfccf109aa 100644 (file)
@@ -3771,6 +3771,9 @@ bool Parser::isDeclarationSpecifier(bool DisambiguatingWithExpression) {
   case tok::kw_virtual:
   case tok::kw_explicit:
 
+    // friend keyword.
+  case tok::kw_friend:
+
     // static_assert-declaration
   case tok::kw__Static_assert:
 
@@ -3779,11 +3782,10 @@ bool Parser::isDeclarationSpecifier(bool DisambiguatingWithExpression) {
 
     // GNU attributes.
   case tok::kw___attribute:
-    return true;
 
-    // C++0x decltype.
+    // C++11 decltype and constexpr.
   case tok::annot_decltype:
-    return true;
+  case tok::kw_constexpr:
 
     // C11 _Atomic()
   case tok::kw__Atomic:
index ff687583c253e3d6a82f161b8641bc88791424dc..784002d536776b859154ec45276caf5bc1caf5fe 100644 (file)
@@ -23,12 +23,15 @@ void g() {
 struct S {
   int a, b, c;
   S();
+  int x // expected-error {{expected ';'}}
+  friend void f()
 };
 8S::S() : a{ 5 }, b{ 6 }, c{ 2 } { // expected-error {{unqualified-id}}
   return;
 }
 int k;
-int l = k;
+int l = k // expected-error {{expected ';'}}
+constexpr int foo();
 
 5int m = { l }, n = m; // expected-error {{unqualified-id}}