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