diff options
author | John McCall <rjmccall@apple.com> | 2011-02-21 02:28:50 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2011-02-21 02:28:50 +0000 |
commit | aa46fe44a8b8f41d92a4ee006d6e370222c8bc87 (patch) | |
tree | 0f6a198dca79edc66bf9c2c7c329cdddab2c7728 /test/CodeGenCXX/conditional-gnu-ext.cpp | |
parent | 34d49471e0b6386aefdc0f6bd15e4a4876ce5db1 (diff) |
Rename test/CodeGenCXX/gnu-conditional-scalar-ext.cpp to conditional-gnu-ext.cpp
for consistency with other tests (and to remove "scalar" from the name).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126104 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/conditional-gnu-ext.cpp')
-rw-r--r-- | test/CodeGenCXX/conditional-gnu-ext.cpp | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/test/CodeGenCXX/conditional-gnu-ext.cpp b/test/CodeGenCXX/conditional-gnu-ext.cpp new file mode 100644 index 0000000000..fea83645a5 --- /dev/null +++ b/test/CodeGenCXX/conditional-gnu-ext.cpp @@ -0,0 +1,62 @@ +// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s | FileCheck %s +// rdar: // 8353567 +// pr7726 + +extern "C" int printf(...); + +void test0() { +// CHECK: call i32 (...)* @printf({{.*}}, i8* inttoptr (i64 3735928559 to i8*)) + printf("%p\n", (void *)0xdeadbeef ? : (void *)0xaaaaaa); +} + +// rdar://8446940 +namespace radar8446940 { +extern "C" void abort(); + +int main () { + char x[1]; + char *y = x ? : 0; + + if (x != y) + abort(); +} +} + +namespace radar8453812 { +extern "C" void abort(); +_Complex int getComplex(_Complex int val) { + static int count; + if (count++) + abort(); + return val; +} + +_Complex int cmplx() { + _Complex int cond; + _Complex int rhs; + + return getComplex(1+2i) ? : rhs; +} + +// lvalue test +void foo (int& lv) { + ++lv; +} + +int global = 1; + +int &cond() { + static int count; + if (count++) + abort(); + return global; +} + + +int main() { + cmplx(); + int rhs = 10; + foo (cond()? : rhs); + return global-2; +} +} |