aboutsummaryrefslogtreecommitdiff
path: root/test/SemaCXX/lambda-expressions.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2012-10-20 01:38:33 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2012-10-20 01:38:33 +0000
commit5016a70c183a50845a0421802d161093dd0643f6 (patch)
treef06564c7146ab4ad5e59659dc1b67741c07e2b17 /test/SemaCXX/lambda-expressions.cpp
parent0872a06d1ee1a3b62ef833f955051418d18006a1 (diff)
DR1472: A reference isn't odr-used if it has preceding initialization,
initialized by a reference constant expression. Our odr-use modeling still needs work here: we don't yet implement the 'set of potential results of an expression' DR. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166361 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaCXX/lambda-expressions.cpp')
-rw-r--r--test/SemaCXX/lambda-expressions.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/test/SemaCXX/lambda-expressions.cpp b/test/SemaCXX/lambda-expressions.cpp
index babe743c65..0630aedf77 100644
--- a/test/SemaCXX/lambda-expressions.cpp
+++ b/test/SemaCXX/lambda-expressions.cpp
@@ -83,12 +83,15 @@ 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}}
+ // References can appear in constant expressions if they are initialized by
+ // reference constant expressions.
+ int i;
+ 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}}
+
+ static int j;
+ int &ref_j = j;
+ [] { return ref_j; }; // ok
}
}