Fix the clang-wpa example.
[clang.git] / test / CodeGenCXX / gnu-conditional-scalar-ext.cpp
blob25eafc7e1b103d12fb536ff922eda89f50f596c0
1 // RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s | FileCheck %s
2 // rdar: // 8353567
3 // pr7726
5 extern "C" int printf(...);
7 int main(int argc, char **argv) {
8 // CHECK: phi i8* [ inttoptr (i64 3735928559 to i8*),
9 printf("%p\n", (void *)0xdeadbeef ? : (void *)0xaaaaaa);
10 return 0;
13 // rdar://8446940
14 namespace radar8446940 {
15 extern "C" void abort();
17 int main () {
18 char x[1];
19 char *y = x ? : 0;
21 if (x != y)
22 abort();
26 namespace radar8453812 {
27 extern "C" void abort();
28 _Complex int getComplex(_Complex int val) {
29 static int count;
30 if (count++)
31 abort();
32 return val;
35 _Complex int cmplx() {
36 _Complex int cond;
37 _Complex int rhs;
39 return getComplex(1+2i) ? : rhs;
42 // lvalue test
43 void foo (int& lv) {
44 ++lv;
47 int global = 1;
49 int &cond() {
50 static int count;
51 if (count++)
52 abort();
53 return global;
57 int main() {
58 cmplx();
59 int rhs = 10;
60 foo (cond()? : rhs);
61 return global-2;