]> granicus.if.org Git - clang/commitdiff
Do not warn about a function decl / direct init ambiguity if the function has a trail...
authorRichard Smith <richard-llvm@metafoo.co.uk>
Mon, 23 Jul 2012 21:41:30 +0000 (21:41 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Mon, 23 Jul 2012 21:41:30 +0000 (21:41 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160646 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Parse/ParseTentative.cpp
test/Parser/cxx0x-ambig.cpp

index 41d793f3f29a095e12617d96af64654255911781..8cf1c29078c8d951ed68fffdc73c9defe31560ea 100644 (file)
@@ -1293,7 +1293,7 @@ bool Parser::isCXXFunctionDeclarator(bool warnIfAmbiguous) {
           Next.is(tok::kw_throw) || Next.is(tok::kw_noexcept) ||
           Next.is(tok::l_square) || isCXX0XVirtSpecifier(Next) ||
           Next.is(tok::l_brace) || Next.is(tok::kw_try) ||
-          Next.is(tok::equal))
+          Next.is(tok::equal) || Next.is(tok::arrow))
         // The next token cannot appear after a constructor-style initializer,
         // and can appear next in a function definition. This must be a function
         // declarator.
index e1e6ff76ad89edd0865411bbf8dbde8fab17d9bf..96e200642b56ecce223e297baf8f2778d5b60d33 100644 (file)
@@ -85,7 +85,7 @@ namespace trailing_return {
 
   struct S {
     S(int);
-    S *operator()() const;
+    S *operator()(...) const;
     int n;
   };
 
@@ -94,7 +94,9 @@ namespace trailing_return {
       // This parses as a function declaration, but DR1223 makes the presence of
       // 'auto' be used for disambiguation.
       S(a)()->n; // ok, expression; expected-warning{{expression result unused}}
+      S(a)(int())->n; // ok, expression; expected-warning{{expression result unused}}
       auto(a)()->n; // ok, function declaration
+      auto(b)(int())->n; // ok, function declaration
       using T = decltype(a);
       using T = auto() -> n;
     }