aboutsummaryrefslogtreecommitdiff
path: root/lib/Parse/ParseExprCXX.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2012-08-09 19:01:51 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2012-08-09 19:01:51 +0000
commit950435c15e413c55859f8af78d2c6e603743b42f (patch)
tree4519ae7edf1c363b5e0c2d68ae123098983b9c9c /lib/Parse/ParseExprCXX.cpp
parent5960f4aeac9760198c80e05d70d8dadb1db0ff0e (diff)
In 'delete []', the '[]' never starts a lambda. Update a FIXME with a standard reference and add a test.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161604 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseExprCXX.cpp')
-rw-r--r--lib/Parse/ParseExprCXX.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/Parse/ParseExprCXX.cpp b/lib/Parse/ParseExprCXX.cpp
index 592a3cc160..afac25793a 100644
--- a/lib/Parse/ParseExprCXX.cpp
+++ b/lib/Parse/ParseExprCXX.cpp
@@ -2403,10 +2403,14 @@ Parser::ParseCXXDeleteExpression(bool UseGlobal, SourceLocation Start) {
// 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);