diff options
author | ed <ed@FreeBSD.org> | 2009-06-02 17:58:47 +0000 |
---|---|---|
committer | ed <ed@FreeBSD.org> | 2009-06-02 17:58:47 +0000 |
commit | f27e5a09a0d815b8a4814152954ff87dadfdefc0 (patch) | |
tree | ce7d964cbb5e39695b71481698f10cb099c23d4a /test/Sema/complex-int.c | |
download | FreeBSD-src-f27e5a09a0d815b8a4814152954ff87dadfdefc0.zip FreeBSD-src-f27e5a09a0d815b8a4814152954ff87dadfdefc0.tar.gz |
Import Clang, at r72732.
Diffstat (limited to 'test/Sema/complex-int.c')
-rw-r--r-- | test/Sema/complex-int.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/test/Sema/complex-int.c b/test/Sema/complex-int.c new file mode 100644 index 0000000..5977b4d --- /dev/null +++ b/test/Sema/complex-int.c @@ -0,0 +1,52 @@ +// RUN: clang-cc %s -verify -fsyntax-only + +void a() { +__complex__ int arr; +__complex__ short brr; +__complex__ unsigned xx; +__complex__ signed yy; +__complex__ int result; +int ii; +int aa = 1 + 1.0iF; + +result = arr*ii; +result = ii*brr; + +result = arr*brr; +result = xx*yy; + +switch (arr) { // expected-error{{statement requires expression of integer type ('_Complex int' invalid)}} + case brr: ; // expected-error{{expression is not an integer constant expression}} + case xx: ; // expected-error{{expression is not an integer constant expression}} +} +} + +void Tester() { +__complex short a1; +__complex int a2; +__complex float a3; +__complex double a4; +short a5; +int a6; +float a7; +double a8; +#define TestPair(m,n) int x##m##n = a##m+a##n; +#define TestPairs(m) TestPair(m,1) TestPair(m,2) \ + TestPair(m,3) TestPair(m,4) \ + TestPair(m,5) TestPair(m,6) \ + TestPair(m,7) TestPair(m,8) +TestPairs(1); TestPairs(2); +TestPairs(3); TestPairs(4); +TestPairs(5); TestPairs(6); +TestPairs(7); TestPairs(8); +} + +// rdar://6097730 +void test3(_Complex int *x) { + *x = ~*x; +} + +void test4(_Complex float *x) { + *x = ~*x; +} + |