diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2010-05-04 17:59:32 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2010-05-04 17:59:32 +0000 |
commit | d33ded52b06f7be00b95c1ce546924b4468adf9a (patch) | |
tree | 7d4c16cc5b807b12edd9bd8e544e646272690ade /test/CodeGenCXX/reference-in-blocks.cpp | |
parent | 6c1cb9916e9988dcdd65b9266dbe24afd173427a (diff) |
Fixes a code gen crash when block is a reference type, etc.
(radar 7495203).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103022 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/reference-in-blocks.cpp')
-rw-r--r-- | test/CodeGenCXX/reference-in-blocks.cpp | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/test/CodeGenCXX/reference-in-blocks.cpp b/test/CodeGenCXX/reference-in-blocks.cpp index c020bab0f7..388ec7c4bb 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; } - |