From 222e2a7620e6520ffaf4fc4e69d79c18da31542e Mon Sep 17 00:00:00 2001 From: "Zancanaro; Carlo" Date: Mon, 24 Sep 2012 09:58:17 +1000 Subject: Add the clang library to the repo (with some of my changes, too). --- clang/test/CodeGenObjCXX/blocks.mm | 46 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 clang/test/CodeGenObjCXX/blocks.mm (limited to 'clang/test/CodeGenObjCXX/blocks.mm') diff --git a/clang/test/CodeGenObjCXX/blocks.mm b/clang/test/CodeGenObjCXX/blocks.mm new file mode 100644 index 0000000..126931d --- /dev/null +++ b/clang/test/CodeGenObjCXX/blocks.mm @@ -0,0 +1,46 @@ +// RUN: %clang_cc1 -x objective-c++ -fblocks -triple x86_64-apple-darwin -fobjc-fragile-abi %s -verify -emit-llvm -o %t +// rdar://8979379 + +@interface A +@end + +@interface B : A +@end + +void f(int (^bl)(B* b)); + +// Test1 +void g() { + f(^(A* a) { return 0; }); +} + +// Test2 +void g1() { + int (^bl)(B* b) = ^(A* a) { return 0; }; +} + +// Test3 +@protocol NSObject; + +void bar(id(^)(void)); + +void foo(id (^objectCreationBlock)(void)) { + return bar(objectCreationBlock); +} + +// Test4 +struct S { + S *(^a)() = ^{ // expected-warning {{C++11}} + return this; + }; +}; +S s; + +// Test5 +struct X { + void f() { + ^ { + struct Nested { Nested *ptr = this; }; // expected-warning {{C++11}} + } (); + }; +}; -- cgit v1.2.3