Fariborz Jahanian | 9985038 | 2012-04-12 17:49:18 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -x objective-c++ -fblocks -fms-extensions -rewrite-objc %s -o %t-rw.cpp |
| 2 | // RUN: %clang_cc1 -fsyntax-only -Wno-address-of-temporary -D"__declspec(X)=" %t-rw.cpp |
| 3 | // rdar://11231426 |
| 4 | |
Fariborz Jahanian | 8b08adb | 2012-05-03 21:44:12 +0000 | [diff] [blame] | 5 | // rdar://11375908 |
| 6 | typedef unsigned long size_t; |
| 7 | |
Fariborz Jahanian | 9985038 | 2012-04-12 17:49:18 +0000 | [diff] [blame] | 8 | typedef bool BOOL; |
| 9 | |
| 10 | BOOL yes() { |
| 11 | return __objc_yes; |
| 12 | } |
| 13 | |
| 14 | BOOL no() { |
| 15 | return __objc_no; |
| 16 | } |
| 17 | |
| 18 | BOOL which (int flag) { |
| 19 | return flag ? yes() : no(); |
| 20 | } |
| 21 | |
| 22 | int main() { |
| 23 | which (__objc_yes); |
| 24 | which (__objc_no); |
| 25 | return __objc_yes; |
| 26 | } |
| 27 | |
| 28 | void y(BOOL (^foo)()); |
| 29 | |
| 30 | void x() { |
| 31 | y(^{ |
| 32 | return __objc_yes; |
| 33 | }); |
| 34 | } |