summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/new-delete-0x.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Added a better diagnostic when using the delete operator with lambdasNicolas Lesser2019-05-191-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This adds a new error for missing parentheses around lambdas in delete operators. ``` int main() { delete []() { return new int(); }(); } ``` This will result in: ``` test.cpp:2:3: error: '[]' after delete interpreted as 'delete[]' delete []() { return new int(); }(); ^~~~~~~~~ test.cpp:2:9: note: add parentheses around the lambda delete []() { return new int(); }(); ^ ( ) ``` Reviewers: rsmith Reviewed By: rsmith Subscribers: riccibruno, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D36357 llvm-svn: 361119
* Sema: Do not allow lambda expressions to appear inside of constant expressionsDavid Majnemer2013-10-251-1/+3
| | | | | | | | | We would previously not diagnose this which would lead to crashes (on very strange code). This fixes PR17675. llvm-svn: 193397
* Update test FIXME: The '[]' in 'delete []' is never part of a lambda.Richard Smith2012-10-171-2/+7
| | | | llvm-svn: 166090
* Disambiguation of '[[':Richard Smith2012-04-101-0/+32
* In C++11, '[[' is ill-formed unless it starts an attribute-specifier. Reject array sizes and array indexes which begin with a lambda-expression. Recover by parsing the lambda as a lambda. * In Objective-C++11, either '[' could be the start of a message-send. Fully disambiguate this case: it turns out that the grammars of message-sends, lambdas and attributes do not actually overlap. Accept any occurrence of '[[' where either '[' starts a message send, but reject a lambda in an array index just like in C++11 mode. Implement a couple of changes to the attribute wording which occurred after our attributes implementation landed: * In a function-declaration, the attributes go after the exception specification, not after the right paren. * A reference type can have attributes applied. * An 'identifier' in an attribute can also be a keyword. Support for alternative tokens (iso646 keywords) in attributes to follow. And some bug fixes: * Parse attributes after declarator-ids, even if they are not simple identifiers. * Do not accept attributes after a parenthesized declarator. * Accept attributes after an array size in a new-type-id. * Partially disamiguate 'delete' followed by a lambda. More work is required here for the case where the lambda-introducer is '[]'. llvm-svn: 154369
OpenPOWER on IntegriCloud