summaryrefslogtreecommitdiffstats
path: root/test/CodeGenCXX
diff options
context:
space:
mode:
Diffstat (limited to 'test/CodeGenCXX')
-rw-r--r--test/CodeGenCXX/reference-in-blocks.cpp24
1 files changed, 23 insertions, 1 deletions
diff --git a/test/CodeGenCXX/reference-in-blocks.cpp b/test/CodeGenCXX/reference-in-blocks.cpp
index c020bab..388ec7c 100644
--- a/test/CodeGenCXX/reference-in-blocks.cpp
+++ b/test/CodeGenCXX/reference-in-blocks.cpp
@@ -9,6 +9,26 @@ T _i;
T get() {return _i;};
};
+// rdar: // 7495203
+class A {
+ public:
+ A() : field(10), d1(3.14) {}
+ void F();
+ void S() {
+ printf(" field = %d\n", field);
+ printf(" field = %f\n", d1);
+ }
+ int field;
+ double d1;
+};
+
+void A::F()
+ {
+ __block A &tlc = *this;
+ // crashed in code gen (radar 7495203)
+ ^{ tlc.S(); }();
+ }
+
int main() {
// works
@@ -16,6 +36,8 @@ int main() {
//crashes in godegen?
void (^bl2)(range<int>& ) = ^(range<int>& i){printf("Hello Blocks %d\n", i.get()); };
+
+ A *a = new A;
+ a->F();
return 0;
}
-
OpenPOWER on IntegriCloud