1 | // RUN: %clang_cc1 %s -fsyntax-only -fblocks -verify -Wno-unreachable-code |
2 | |
3 | // rdar://6597252 |
4 | Class test1(Class X) { |
5 | return 1 ? X : X; |
6 | } |
7 | |
8 | |
9 | // rdar://6079877 |
10 | void test2() { |
11 | id str = @"foo" |
12 | "bar\0" // no-warning |
13 | @"baz" " blarg"; |
14 | id str2 = @"foo" |
15 | "bar" |
16 | @"baz" |
17 | " b\0larg"; // no-warning |
18 | |
19 | |
20 | if (@encode(int) == "foo") { } // expected-warning {{result of comparison against @encode is unspecified}} |
21 | } |
22 | |
23 | #define MAX(A,B) ({ __typeof__(A) __a = (A); __typeof__(B) __b = (B); __a < __b ? __b : __a; }) |
24 | void (^foo)(int, int) = ^(int x, int y) { int z = MAX(x, y); }; |
25 | |
26 | |
27 | |
28 | // rdar://8445858 |
29 | @class Object; |
30 | static Object *g; |
31 | void test3(Object *o) { |
32 | // this is ok. |
33 | __sync_bool_compare_and_swap(&g, 0, o); |
34 | } |
35 | |
36 | @class Incomplete_ObjC_class; // expected-note{{forward declaration of class here}} |
37 | struct Incomplete_struct; // expected-note {{forward declaration}} |
38 | |
39 | void test_encode() { |
40 | (void)@encode(Incomplete_ObjC_class); // expected-error {{incomplete type}} |
41 | (void)@encode(struct Incomplete_struct); // expected-error {{incomplete type}} |
42 | (void)@encode(Incomplete_ObjC_class*); |
43 | (void)@encode(id); |
44 | } |
45 | |