Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame^] | 1 | // RUN: %clang_cc1 -emit-llvm %s -o %t |
Chris Lattner | 8da1cb6 | 2007-07-13 20:18:44 +0000 | [diff] [blame] | 2 | |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 3 | float test1(int cond, float a, float b) { |
Chris Lattner | 8da1cb6 | 2007-07-13 20:18:44 +0000 | [diff] [blame] | 4 | return cond ? a : b; |
5 | } | ||||
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 6 | |
7 | double test2(int cond, float a, double b) { | ||||
Chris Lattner | 8da1cb6 | 2007-07-13 20:18:44 +0000 | [diff] [blame] | 8 | return cond ? a : b; |
9 | } | ||||
Chris Lattner | 2202bce | 2007-11-30 17:56:23 +0000 | [diff] [blame] | 10 | |
11 | void f(); | ||||
12 | |||||
13 | void test3(){ | ||||
14 | 1 ? f() : (void)0; | ||||
15 | } | ||||
16 | |||||
Eli Friedman | b1284ac | 2008-01-30 17:02:03 +0000 | [diff] [blame] | 17 | void test4() { |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 18 | int i; short j; |
19 | float* k = 1 ? &i : &j; | ||||
Eli Friedman | b1284ac | 2008-01-30 17:02:03 +0000 | [diff] [blame] | 20 | } |
Eli Friedman | 68f624e | 2008-02-10 23:18:23 +0000 | [diff] [blame] | 21 | |
22 | void test5() { | ||||
23 | const int* cip; | ||||
24 | void* vp; | ||||
25 | cip = 0 ? vp : cip; | ||||
26 | } | ||||
Eli Friedman | 145c083 | 2008-05-16 17:37:11 +0000 | [diff] [blame] | 27 | |
28 | void test6(); | ||||
29 | void test7(int); | ||||
30 | void* test8() {return 1 ? test6 : test7;} | ||||
31 | |||||
Nuno Lopes | 108f55d | 2008-06-04 19:15:45 +0000 | [diff] [blame] | 32 | |
33 | void _efree(void *ptr); | ||||
34 | |||||
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 35 | void _php_stream_free3() { |
36 | (1 ? free(0) : _efree(0)); | ||||
Nuno Lopes | 108f55d | 2008-06-04 19:15:45 +0000 | [diff] [blame] | 37 | } |
38 | |||||
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 39 | void _php_stream_free4() { |
40 | 1 ? _efree(0) : free(0); | ||||
Nuno Lopes | 108f55d | 2008-06-04 19:15:45 +0000 | [diff] [blame] | 41 | } |
Eli Friedman | 16fea9b | 2009-11-17 01:22:05 +0000 | [diff] [blame] | 42 | |
43 | // PR5526 | ||||
44 | struct test9 { int a; }; | ||||
45 | void* test9spare(); | ||||
46 | void test9(struct test9 *p) { | ||||
47 | p ? p : test9spare(); | ||||
48 | } | ||||
49 |