summaryrefslogtreecommitdiffstats
path: root/clang/test/CXX/expr/expr.prim/expr.prim.lambda
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2012-02-21 19:11:17 +0000
committerDouglas Gregor <dgregor@apple.com>2012-02-21 19:11:17 +0000
commit680e9e018d9f4be8d87f661760afec91fdabb556 (patch)
tree7e843fa74bef0fc36f434a2c5a864282648534e2 /clang/test/CXX/expr/expr.prim/expr.prim.lambda
parent4930dd6841d147f7aea4964c0a74213e714bc048 (diff)
downloadbcm5719-llvm-680e9e018d9f4be8d87f661760afec91fdabb556.tar.gz
bcm5719-llvm-680e9e018d9f4be8d87f661760afec91fdabb556.zip
Improve our handling of lambda expressions that occur within default
arguments. There are two aspects to this: - Make sure that when marking the declarations referenced in a default argument, we don't try to mark local variables, both because it's a waste of time and because the semantics are wrong: we're not in a place where we could capture these variables again even if it did make sense. - When a lambda expression occurs in a default argument of a function template, make sure that the corresponding closure type is considered dependent, so that it will get properly instantiated. The second bit is a bit of a hack; to fix it properly, we may have to rearchitect our handling of default arguments, parsing them only after creating the function definition. However, I'd like to separate that work from the lambdas work. llvm-svn: 151076
Diffstat (limited to 'clang/test/CXX/expr/expr.prim/expr.prim.lambda')
-rw-r--r--clang/test/CXX/expr/expr.prim/expr.prim.lambda/p13.cpp6
1 files changed, 6 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
index 53f458a824d..8bb707e0dbc 100644
--- a/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p13.cpp
+++ b/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p13.cpp
@@ -8,3 +8,9 @@ void f2() {
void g4(int = ([=]{ return 0; })());
void g5(int = ([]{ return sizeof i; })());
}
+
+namespace lambda_in_default_args {
+ int f(int = [] () -> int { int n; return ++n; } ());
+ template<typename T> T g(T = [] () -> T { T n; return ++n; } ());
+ int k = f() + g<int>();
+}
OpenPOWER on IntegriCloud