From 9adc361008e25f5b7d9c3aa8968832384d21c12a Mon Sep 17 00:00:00 2001 From: David Majnemer Date: Fri, 25 Oct 2013 09:12:52 +0000 Subject: Sema: Do not allow lambda expressions to appear inside of constant expressions We would previously not diagnose this which would lead to crashes (on very strange code). This fixes PR17675. llvm-svn: 193397 --- clang/test/SemaCXX/new-delete-0x.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'clang/test/SemaCXX/new-delete-0x.cpp') diff --git a/clang/test/SemaCXX/new-delete-0x.cpp b/clang/test/SemaCXX/new-delete-0x.cpp index 9e3b4928b14..a11392d5896 100644 --- a/clang/test/SemaCXX/new-delete-0x.cpp +++ b/clang/test/SemaCXX/new-delete-0x.cpp @@ -21,7 +21,9 @@ void bad_news(int *ip) auto s = new int*[[]{return 1;}()][2]; // expected-error {{expected ']'}} // ... but not here: auto t = new (int(*)[[]]); // expected-error {{an attribute list cannot appear here}} - auto u = new (int(*)[[]{return 1;}()][2]); // expected-error {{C++11 only allows consecutive left square brackets when introducing an attribute}} expected-error {{variably modified type}} + auto u = new (int(*)[[]{return 1;}()][2]); // expected-error {{C++11 only allows consecutive left square brackets when introducing an attribute}} \ + expected-error {{variably modified type}} \ + expected-error {{a lambda expression may not appear inside of a constant expression}} } void good_deletes() -- cgit v1.2.3