Do not warn about a function decl / direct init ambiguity if the function has a trailing return type.

llvm-svn: 160646
This commit is contained in:
Richard Smith 2012-07-23 21:41:30 +00:00
parent 2ce6541f3b
commit 45fbfc7f11
2 changed files with 4 additions and 2 deletions

View 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.

View 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;
}