xref: /llvm-project/clang/test/CodeGen/conditional-gnu-ext.c (revision 0f1c1be1968076d6f96f8a7bcc4a15cf195ecd97)
1 // RUN: %clang_cc1 -emit-llvm %s -o %t
2 // PR1824
3 
foo(int x,short y)4 int foo(int x, short y) {
5   return x ?: y;
6 }
7 
test(float x,int Y)8 float test(float x, int Y) {
9   return Y != 0 ? : x;
10 }
11 
12 extern void abort(void);
test1(void)13 void  test1 (void) {
14   char x[1];
15   char *y = x ? : 0;
16 
17   if (x != y)
18     abort();
19 }
20 
getComplex(_Complex int val)21 _Complex int getComplex(_Complex int val) {
22   static int count;
23   if (count++)
24     abort();
25   return val;
26 }
27 
complx(void)28 _Complex int complx(void) {
29     _Complex int cond;
30     _Complex int rhs;
31 
32     return getComplex(1+2i) ? : rhs;
33 }
34