aboutsummaryrefslogtreecommitdiff
path: root/test/SemaCXX/lambda-expressions.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/SemaCXX/lambda-expressions.cpp')
-rw-r--r--test/SemaCXX/lambda-expressions.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/SemaCXX/lambda-expressions.cpp b/test/SemaCXX/lambda-expressions.cpp
index 7e53754a52..9d3f9b857f 100644
--- a/test/SemaCXX/lambda-expressions.cpp
+++ b/test/SemaCXX/lambda-expressions.cpp
@@ -85,6 +85,13 @@ namespace ImplicitCapture {
const int h = a; // expected-note {{declared}}
[]() { return h; }; // expected-error {{variable 'h' cannot be implicitly captured in a lambda with no capture-default specified}} expected-note {{lambda expression begins here}}
+
+ // The exemption for variables which can appear in constant expressions
+ // applies only to objects (and not to references).
+ // FIXME: This might be a bug in the standard.
+ static int i;
+ constexpr int &ref_i = i; // expected-note {{declared}}
+ [] { return ref_i; }; // expected-error {{variable 'ref_i' cannot be implicitly captured in a lambda with no capture-default specified}} expected-note {{lambda expression begins here}}
}
}