1 // RUN: %clang_cc1 %s -verify -fsyntax-only
6 __complex__
unsigned xx
;
8 __complex__
int result
;
14 typedef __complex__
float ComplexFloat
;
15 int cc
= 1 + (ComplexFloat
)(1.0iF
);
23 switch (arr
) { // expected-error{{statement requires expression of integer type ('_Complex int' invalid)}}
24 case brr
: ; // expected-error{{integer constant expression must have integer type}}
25 case xx
: ; // expected-error{{integer constant expression must have integer type}}
28 case brr
: ; // expected-error{{integer constant expression must have integer type}}
29 case xx
: ; // expected-error{{integer constant expression must have integer type}}
42 #define TestPair(m,n) int x##m##n = a##m+a##n;
43 #define TestPairs(m) TestPair(m,1) TestPair(m,2) \
44 TestPair(m,3) TestPair(m,4) \
45 TestPair(m,5) TestPair(m,6) \
46 TestPair(m,7) TestPair(m,8)
47 TestPairs(1); TestPairs(2);
48 TestPairs(3); TestPairs(4);
49 TestPairs(5); TestPairs(6);
50 TestPairs(7); TestPairs(8);
54 void test3(_Complex
int *x
) {
58 void test4(_Complex
float *x
) {
62 void test5(_Complex
int *x
) {
66 // None of these array bounds is an ICE due to the use of literals of
67 // non-integer type. But we can constant-fold all of them.
68 int i1
[(2+3i
)*(5+7i
) == 29i
-11 ? 1 : -1]; // expected-warning {{fold}}
69 int i2
[(29i
-11)/(5+7i
) == 2+3i
? 1 : -1]; // expected-warning {{fold}}
70 int i3
[-(2+3i
) == +(-3i
-2) ? 1 : -1]; // expected-warning {{fold}}
71 int i4
[~(2+3i
) == 2-3i
? 1 : -1]; // expected-warning {{fold}}
72 int i5
[(3i
== -(-3i
) ? ((void)3, 1i
- 1) : 0) == 1i
- 1 ? 1 : -1]; // expected-warning {{fold}}
74 int f1
[(2.0+3.0i
)*(5.0+7.0i
) == 29.0i
-11.0 ? 1 : -1]; // expected-warning {{fold}}
75 int f2
[(29.0i
-11.0)/(5.0+7.0i
) == 2.0+3.0i
? 1 : -1]; // expected-warning {{fold}}
76 int f3
[-(2.0+3.0i
) == +(-3.0i
-2.0) ? 1 : -1]; // expected-warning {{fold}}
77 int f4
[~(2.0+3.0i
) == 2.0-3.0i
? 1 : -1]; // expected-warning {{fold}}
78 int f5
[(3.0i
== -(-3.0i
) ? ((void)3.0, __extension__ (1.0i
- 1.0)) : 0) == 1.0i
- 1.0 ? 1 : -1]; // expected-warning {{fold}}