1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 %s -verify -fsyntax-only
2*f4a2713aSLionel Sambuc
a()3*f4a2713aSLionel Sambuc void a() {
4*f4a2713aSLionel Sambuc __complex__ int arr;
5*f4a2713aSLionel Sambuc __complex__ short brr;
6*f4a2713aSLionel Sambuc __complex__ unsigned xx;
7*f4a2713aSLionel Sambuc __complex__ signed yy;
8*f4a2713aSLionel Sambuc __complex__ int result;
9*f4a2713aSLionel Sambuc int ii;
10*f4a2713aSLionel Sambuc int aa = 1 + 1.0iF;
11*f4a2713aSLionel Sambuc
12*f4a2713aSLionel Sambuc result = arr*ii;
13*f4a2713aSLionel Sambuc result = ii*brr;
14*f4a2713aSLionel Sambuc
15*f4a2713aSLionel Sambuc result = arr*brr;
16*f4a2713aSLionel Sambuc result = xx*yy;
17*f4a2713aSLionel Sambuc
18*f4a2713aSLionel Sambuc switch (arr) { // expected-error{{statement requires expression of integer type ('_Complex int' invalid)}}
19*f4a2713aSLionel Sambuc case brr: ; // expected-error{{expression is not an integer constant expression}}
20*f4a2713aSLionel Sambuc case xx: ; // expected-error{{expression is not an integer constant expression}}
21*f4a2713aSLionel Sambuc }
22*f4a2713aSLionel Sambuc }
23*f4a2713aSLionel Sambuc
Tester()24*f4a2713aSLionel Sambuc void Tester() {
25*f4a2713aSLionel Sambuc __complex short a1;
26*f4a2713aSLionel Sambuc __complex int a2;
27*f4a2713aSLionel Sambuc __complex float a3;
28*f4a2713aSLionel Sambuc __complex double a4;
29*f4a2713aSLionel Sambuc short a5;
30*f4a2713aSLionel Sambuc int a6;
31*f4a2713aSLionel Sambuc float a7;
32*f4a2713aSLionel Sambuc double a8;
33*f4a2713aSLionel Sambuc #define TestPair(m,n) int x##m##n = a##m+a##n;
34*f4a2713aSLionel Sambuc #define TestPairs(m) TestPair(m,1) TestPair(m,2) \
35*f4a2713aSLionel Sambuc TestPair(m,3) TestPair(m,4) \
36*f4a2713aSLionel Sambuc TestPair(m,5) TestPair(m,6) \
37*f4a2713aSLionel Sambuc TestPair(m,7) TestPair(m,8)
38*f4a2713aSLionel Sambuc TestPairs(1); TestPairs(2);
39*f4a2713aSLionel Sambuc TestPairs(3); TestPairs(4);
40*f4a2713aSLionel Sambuc TestPairs(5); TestPairs(6);
41*f4a2713aSLionel Sambuc TestPairs(7); TestPairs(8);
42*f4a2713aSLionel Sambuc }
43*f4a2713aSLionel Sambuc
44*f4a2713aSLionel Sambuc // rdar://6097730
test3(_Complex int * x)45*f4a2713aSLionel Sambuc void test3(_Complex int *x) {
46*f4a2713aSLionel Sambuc *x = ~*x;
47*f4a2713aSLionel Sambuc }
48*f4a2713aSLionel Sambuc
test4(_Complex float * x)49*f4a2713aSLionel Sambuc void test4(_Complex float *x) {
50*f4a2713aSLionel Sambuc *x = ~*x;
51*f4a2713aSLionel Sambuc }
52*f4a2713aSLionel Sambuc
test5(_Complex int * x)53*f4a2713aSLionel Sambuc void test5(_Complex int *x) {
54*f4a2713aSLionel Sambuc (*x)++;
55*f4a2713aSLionel Sambuc }
56*f4a2713aSLionel Sambuc
57*f4a2713aSLionel Sambuc int i1[(2+3i)*(5+7i) == 29i-11 ? 1 : -1];
58*f4a2713aSLionel Sambuc int i2[(29i-11)/(5+7i) == 2+3i ? 1 : -1];
59*f4a2713aSLionel Sambuc int i3[-(2+3i) == +(-3i-2) ? 1 : -1];
60*f4a2713aSLionel Sambuc int i4[~(2+3i) == 2-3i ? 1 : -1];
61*f4a2713aSLionel Sambuc int i5[(3i == -(-3i) ? ((void)3, 1i - 1) : 0) == 1i - 1 ? 1 : -1];
62*f4a2713aSLionel Sambuc
63*f4a2713aSLionel Sambuc int f1[(2.0+3.0i)*(5.0+7.0i) == 29.0i-11.0 ? 1 : -1];
64*f4a2713aSLionel Sambuc int f2[(29.0i-11.0)/(5.0+7.0i) == 2.0+3.0i ? 1 : -1];
65*f4a2713aSLionel Sambuc int f3[-(2.0+3.0i) == +(-3.0i-2.0) ? 1 : -1];
66*f4a2713aSLionel Sambuc int f4[~(2.0+3.0i) == 2.0-3.0i ? 1 : -1];
67*f4a2713aSLionel Sambuc int f5[(3.0i == -(-3.0i) ? ((void)3.0, __extension__ (1.0i - 1.0)) : 0) == 1.0i - 1.0 ? 1 : -1];
68