[cfe-commits] r160646 - in /cfe/trunk: lib/Parse/ParseTentative.cpp test/Parser/cxx0x-ambig.cpp
Richard Smith
richard-llvm at metafoo.co.uk
Mon Jul 23 14:41:30 PDT 2012
Author: rsmith
Date: Mon Jul 23 16:41:30 2012
New Revision: 160646
URL: http://llvm.org/viewvc/llvm-project?rev=160646&view=rev
Log:
Do not warn about a function decl / direct init ambiguity if the function has a trailing return type.
Modified:
cfe/trunk/lib/Parse/ParseTentative.cpp
cfe/trunk/test/Parser/cxx0x-ambig.cpp
Modified: cfe/trunk/lib/Parse/ParseTentative.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseTentative.cpp?rev=160646&r1=160645&r2=160646&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseTentative.cpp (original)
+++ cfe/trunk/lib/Parse/ParseTentative.cpp Mon Jul 23 16:41:30 2012
@@ -1293,7 +1293,7 @@
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.
Modified: cfe/trunk/test/Parser/cxx0x-ambig.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/cxx0x-ambig.cpp?rev=160646&r1=160645&r2=160646&view=diff
==============================================================================
--- cfe/trunk/test/Parser/cxx0x-ambig.cpp (original)
+++ cfe/trunk/test/Parser/cxx0x-ambig.cpp Mon Jul 23 16:41:30 2012
@@ -85,7 +85,7 @@
struct S {
S(int);
- S *operator()() const;
+ S *operator()(...) const;
int n;
};
@@ -94,7 +94,9 @@
// 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;
}
More information about the cfe-commits
mailing list