blob: d079aafd787ade3ae6fb633e2ef99a5cc5db48d1 [file] [log] [blame]
Daniel Dunbara5728872009-12-15 20:14:24 +00001// RUN: %clang_cc1 -emit-llvm %s -o %t
Chris Lattner8da1cb62007-07-13 20:18:44 +00002
Mike Stump1eb44332009-09-09 15:08:12 +00003float test1(int cond, float a, float b) {
Chris Lattner8da1cb62007-07-13 20:18:44 +00004 return cond ? a : b;
5}
Mike Stump1eb44332009-09-09 15:08:12 +00006
7double test2(int cond, float a, double b) {
Chris Lattner8da1cb62007-07-13 20:18:44 +00008 return cond ? a : b;
9}
Chris Lattner2202bce2007-11-30 17:56:23 +000010
11void f();
12
13void test3(){
14 1 ? f() : (void)0;
15}
16
Eli Friedmanb1284ac2008-01-30 17:02:03 +000017void test4() {
Mike Stump1eb44332009-09-09 15:08:12 +000018 int i; short j;
19 float* k = 1 ? &i : &j;
Eli Friedmanb1284ac2008-01-30 17:02:03 +000020}
Eli Friedman68f624e2008-02-10 23:18:23 +000021
22void test5() {
23 const int* cip;
24 void* vp;
25 cip = 0 ? vp : cip;
26}
Eli Friedman145c0832008-05-16 17:37:11 +000027
28void test6();
29void test7(int);
30void* test8() {return 1 ? test6 : test7;}
31
Nuno Lopes108f55d2008-06-04 19:15:45 +000032
33void _efree(void *ptr);
34
Mike Stump1eb44332009-09-09 15:08:12 +000035void _php_stream_free3() {
36 (1 ? free(0) : _efree(0));
Nuno Lopes108f55d2008-06-04 19:15:45 +000037}
38
Mike Stump1eb44332009-09-09 15:08:12 +000039void _php_stream_free4() {
40 1 ? _efree(0) : free(0);
Nuno Lopes108f55d2008-06-04 19:15:45 +000041}
Eli Friedman16fea9b2009-11-17 01:22:05 +000042
43// PR5526
44struct test9 { int a; };
45void* test9spare();
46void test9(struct test9 *p) {
47 p ? p : test9spare();
48}
49