diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-07-23 21:41:30 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-07-23 21:41:30 +0000 |
commit | 5969a5f1b730775af4afb8f95f6c8c306ab08227 (patch) | |
tree | f9c4c2e465e108ad81174c48f7d1b60068826947 | |
parent | e1ecdc168175719d74e112bcacd4aae5e12d4631 (diff) |
Do not warn about a function decl / direct init ambiguity if the function has a trailing return type.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160646 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Parse/ParseTentative.cpp | 2 | ||||
-rw-r--r-- | test/Parser/cxx0x-ambig.cpp | 4 |
2 files changed, 4 insertions, 2 deletions
diff --git a/lib/Parse/ParseTentative.cpp b/lib/Parse/ParseTentative.cpp index 41d793f3f2..8cf1c29078 100644 --- a/lib/Parse/ParseTentative.cpp +++ b/lib/Parse/ParseTentative.cpp @@ -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. diff --git a/test/Parser/cxx0x-ambig.cpp b/test/Parser/cxx0x-ambig.cpp index e1e6ff76ad..96e200642b 100644 --- a/test/Parser/cxx0x-ambig.cpp +++ b/test/Parser/cxx0x-ambig.cpp @@ -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; } |