summaryrefslogtreecommitdiffstats
path: root/clang/test/Parser/cxx0x-lambda-expressions.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2014-04-13 04:31:48 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2014-04-13 04:31:48 +0000
commit9e2f0a4f628b2cefb9a234c3c66f820bdbc966fc (patch)
tree243b31598db83cc659cf606531530741e4836db4 /clang/test/Parser/cxx0x-lambda-expressions.cpp
parent0563ca1be808a14863d87f3c878c30555328b0bf (diff)
downloadbcm5719-llvm-9e2f0a4f628b2cefb9a234c3c66f820bdbc966fc.tar.gz
bcm5719-llvm-9e2f0a4f628b2cefb9a234c3c66f820bdbc966fc.zip
PR19339: Disambiguate lambdas with init-captures from designated initializers
properly. llvm-svn: 206128
Diffstat (limited to 'clang/test/Parser/cxx0x-lambda-expressions.cpp')
-rw-r--r--clang/test/Parser/cxx0x-lambda-expressions.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/clang/test/Parser/cxx0x-lambda-expressions.cpp b/clang/test/Parser/cxx0x-lambda-expressions.cpp
index 53ea05ea860..8cfe7f3b02d 100644
--- a/clang/test/Parser/cxx0x-lambda-expressions.cpp
+++ b/clang/test/Parser/cxx0x-lambda-expressions.cpp
@@ -2,6 +2,8 @@
enum E { e };
+constexpr int id(int n) { return n; }
+
class C {
int f() {
@@ -34,12 +36,18 @@ class C {
typedef int T;
const int b = 0;
const int c = 1;
+ int d;
int a1[1] = {[b] (T()) {}}; // expected-error{{no viable conversion from '(lambda}}
int a2[1] = {[b] = 1 };
- int a3[1] = {[b,c] = 1 }; // expected-error{{expected body of lambda expression}}
+ int a3[1] = {[b,c] = 1 }; // expected-error{{expected ']'}} expected-note {{to match}}
int a4[1] = {[&b] = 1 }; // expected-error{{integral constant expression must have integral or unscoped enumeration type, not 'const int *'}}
int a5[3] = { []{return 0;}() };
int a6[1] = {[this] = 1 }; // expected-error{{integral constant expression must have integral or unscoped enumeration type, not 'C *'}}
+ int a7[1] = {[d(0)] { return d; } ()}; // expected-warning{{extension}}
+ int a8[1] = {[d = 0] { return d; } ()}; // expected-warning{{extension}}
+ int a9[1] = {[d = 0] = 1}; // expected-error{{is not an integral constant expression}}
+ int a10[1] = {[id(0)] { return id; } ()}; // expected-warning{{extension}}
+ int a11[1] = {[id(0)] = 1};
}
void delete_lambda(int *p) {
OpenPOWER on IntegriCloud