aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/CodeGenCXX/const-init-cxx11.cpp6
-rw-r--r--test/CodeGenCXX/for-range.cpp2
-rw-r--r--test/CodeGenCXX/lambda-expressions.cpp9
-rw-r--r--test/SemaCXX/lambda-expressions.cpp13
4 files changed, 19 insertions, 11 deletions
diff --git a/test/CodeGenCXX/const-init-cxx11.cpp b/test/CodeGenCXX/const-init-cxx11.cpp
index db1bb41260..833adba8ba 100644
--- a/test/CodeGenCXX/const-init-cxx11.cpp
+++ b/test/CodeGenCXX/const-init-cxx11.cpp
@@ -432,11 +432,7 @@ namespace InitFromConst {
// CHECK: call void @_ZN13InitFromConst7consumeIRKNS_1SEEEvT_(%"struct.InitFromConst::S"* @_ZN13InitFromConstL1sE)
consume<const S&>(s);
- // FIXME CHECK-NOT: call void @_ZN13InitFromConst7consumeIRKNS_1SEEEvT_(%"struct.InitFromConst::S"* @_ZN13InitFromConstL1sE)
- // There's no lvalue-to-rvalue conversion here, so 'r' is odr-used, and
- // we're permitted to emit a load of it. This seems likely to be a defect
- // in the standard. If we start emitting a direct reference to 's', update
- // this test.
+ // CHECK: call void @_ZN13InitFromConst7consumeIRKNS_1SEEEvT_(%"struct.InitFromConst::S"* @_ZN13InitFromConstL1sE)
consume<const S&>(r);
// CHECK: call void @_ZN13InitFromConst7consumeIPKNS_1SEEEvT_(%"struct.InitFromConst::S"* @_ZN13InitFromConstL1sE)
diff --git a/test/CodeGenCXX/for-range.cpp b/test/CodeGenCXX/for-range.cpp
index 929e33ca96..926fe445a5 100644
--- a/test/CodeGenCXX/for-range.cpp
+++ b/test/CodeGenCXX/for-range.cpp
@@ -40,7 +40,7 @@ void for_array() {
// CHECK-NOT: 5begin
// CHECK-NOT: 3end
// CHECK: getelementptr {{.*}}, i32 0
- // CHECK: getelementptr {{.*}}, i64 5
+ // CHECK: getelementptr {{.*}}, i64 1, i64 0
// CHECK: br label %[[COND:.*]]
// CHECK: [[COND]]:
diff --git a/test/CodeGenCXX/lambda-expressions.cpp b/test/CodeGenCXX/lambda-expressions.cpp
index e872cc494b..cee4f172a0 100644
--- a/test/CodeGenCXX/lambda-expressions.cpp
+++ b/test/CodeGenCXX/lambda-expressions.cpp
@@ -71,6 +71,15 @@ void f() {
int (*fp)(int, int) = [](int x, int y){ return x + y; };
}
+static int k;
+int g() {
+ int &r = k;
+ // CHECK: define internal i32 @"_ZZ1gvENK3$_6clEv"(
+ // CHECK-NOT: }
+ // CHECK: load i32* @_ZL1k,
+ return [] { return r; } ();
+};
+
// CHECK: define internal i32 @"_ZZ1fvEN3$_58__invokeEii"
// CHECK: store i32
// CHECK-NEXT: store i32
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
}
}