blob: d7c122356f5864895310bb6fe15f179c544e4df7 [file] [log] [blame]
Douglas Gregor6cf3f3c2010-03-10 04:54:39 +00001// RUN: %clang_cc1 %s -fsyntax-only -fblocks -verify -Wno-unreachable-code
Chris Lattner2c486602009-02-18 04:38:20 +00002
3// rdar://6597252
Chris Lattnera26fb342009-02-18 17:49:48 +00004Class test1(Class X) {
Chris Lattner2c486602009-02-18 04:38:20 +00005 return 1 ? X : X;
6}
7
Chris Lattnera26fb342009-02-18 17:49:48 +00008
9// rdar://6079877
10void test2() {
11 id str = @"foo"
Ted Kremenek6cd01872011-03-15 21:18:52 +000012 "bar\0" // no-warning
Chris Lattnera26fb342009-02-18 17:49:48 +000013 @"baz" " blarg";
14 id str2 = @"foo"
15 "bar"
16 @"baz"
Ted Kremenek6cd01872011-03-15 21:18:52 +000017 " b\0larg"; // no-warning
Chris Lattner01b8ef22009-04-03 21:11:28 +000018
Chris Lattnera26fb342009-02-18 17:49:48 +000019
Chris Lattner01b8ef22009-04-03 21:11:28 +000020 if (@encode(int) == "foo") { } // expected-warning {{result of comparison against @encode is unspecified}}
Daniel Dunbara45cf5b2009-03-24 02:24:46 +000021}
Douglas Gregor6cf3f3c2010-03-10 04:54:39 +000022
23#define MAX(A,B) ({ __typeof__(A) __a = (A); __typeof__(B) __b = (B); __a < __b ? __b : __a; })
24void (^foo)(int, int) = ^(int x, int y) { int z = MAX(x, y); };
Chris Lattnerbb3bcd82010-09-17 21:12:38 +000025
26
27
28// rdar://8445858
29@class Object;
30static Object *g;
31void test3(Object *o) {
32 // this is ok.
33 __sync_bool_compare_and_swap(&g, 0, o);
34}