In 'delete []', the '[]' never starts a lambda. Update a FIXME with a standard reference and add a test.
llvm-svn: 161604
diff --git a/clang/lib/Parse/ParseExprCXX.cpp b/clang/lib/Parse/ParseExprCXX.cpp
index 592a3cc..afac257 100644
--- a/clang/lib/Parse/ParseExprCXX.cpp
+++ b/clang/lib/Parse/ParseExprCXX.cpp
@@ -2403,10 +2403,14 @@
// Array delete?
bool ArrayDelete = false;
if (Tok.is(tok::l_square) && NextToken().is(tok::r_square)) {
- // FIXME: This could be the start of a lambda-expression. We should
- // disambiguate this, but that will require arbitrary lookahead if
- // the next token is '(':
- // delete [](int*){ /* ... */
+ // C++11 [expr.delete]p1:
+ // Whenever the delete keyword is followed by empty square brackets, it
+ // shall be interpreted as [array delete].
+ // [Footnote: A lambda expression with a lambda-introducer that consists
+ // of empty square brackets can follow the delete keyword if
+ // the lambda expression is enclosed in parentheses.]
+ // FIXME: Produce a better diagnostic if the '[]' is unambiguously a
+ // lambda-introducer.
ArrayDelete = true;
BalancedDelimiterTracker T(*this, tok::l_square);