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 | f0459f87aaf05e76ce0d8c8c1e4c68e3c22195b7 (patch) | |
tree | 7316b75e34f385e6f3290718f651137df4ea3613 /test/CXX/expr/expr.prim/expr.prim.lambda/p13.cpp | |
parent | a63b422eda86b9ff5a08395dcfc288a31419038e (diff) |
Implement C++11 [expr.lambda.prim]p13, which prohibits lambdas in
default arguments if in fact those lambdas capture any entity.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150282 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CXX/expr/expr.prim/expr.prim.lambda/p13.cpp')
-rw-r--r-- | test/CXX/expr/expr.prim/expr.prim.lambda/p13.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/CXX/expr/expr.prim/expr.prim.lambda/p13.cpp b/test/CXX/expr/expr.prim/expr.prim.lambda/p13.cpp new file mode 100644 index 0000000000..53f458a824 --- /dev/null +++ b/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; })()); +} |