diff options
author | Douglas Gregor <dgregor@apple.com> | 2012-02-10 23:30:22 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2012-02-10 23:30:22 +0000 |
commit | f0d495100cf488085328011481e131699e4ad496 (patch) | |
tree | 8552f35daf4eab55fc80f21d46100f3c1ca36537 /clang/test/CXX/expr/expr.prim/expr.prim.lambda/p13.cpp | |
parent | cb1d9f3706172a5d777ab2d50a34985a21f3218b (diff) | |
download | bcm5719-llvm-f0d495100cf488085328011481e131699e4ad496.tar.gz bcm5719-llvm-f0d495100cf488085328011481e131699e4ad496.zip |
Implement C++11 [expr.lambda.prim]p13, which prohibits lambdas in
default arguments if in fact those lambdas capture any entity.
llvm-svn: 150282
Diffstat (limited to 'clang/test/CXX/expr/expr.prim/expr.prim.lambda/p13.cpp')
-rw-r--r-- | clang/test/CXX/expr/expr.prim/expr.prim.lambda/p13.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p13.cpp b/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p13.cpp new file mode 100644 index 00000000000..53f458a824d --- /dev/null +++ b/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p13.cpp @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 -std=c++11 %s -Wunused -verify + +void f2() { + int i = 1; + void g1(int = ([i]{ return i; })()); // expected-error{{lambda expression in default argument cannot capture any entity}} + void g2(int = ([i]{ return 0; })()); // expected-error{{lambda expression in default argument cannot capture any entity}} + void g3(int = ([=]{ return i; })()); // expected-error{{lambda expression in default argument cannot capture any entity}} + void g4(int = ([=]{ return 0; })()); + void g5(int = ([]{ return sizeof i; })()); +} |