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);
53 void test3(_Complex
int *x
) {
57 void test4(_Complex
float *x
) {
61 void test5(_Complex
int *x
) {
65 // None of these array bounds is an ICE due to the use of literals of
66 // non-integer type. But we can constant-fold all of them.
67 int i1
[(2+3i
)*(5+7i
) == 29i
-11 ? 1 : -1]; // expected-warning {{fold}}
68 int i2
[(29i
-11)/(5+7i
) == 2+3i
? 1 : -1]; // expected-warning {{fold}}
69 int i3
[-(2+3i
) == +(-3i
-2) ? 1 : -1]; // expected-warning {{fold}}
70 int i4
[~(2+3i
) == 2-3i
? 1 : -1]; // expected-warning {{fold}}
71 int i5
[(3i
== -(-3i
) ? ((void)3, 1i
- 1) : 0) == 1i
- 1 ? 1 : -1]; // expected-warning {{fold}}
73 int f1
[(2.0+3.0i
)*(5.0+7.0i
) == 29.0i
-11.0 ? 1 : -1]; // expected-warning {{fold}}
74 int f2
[(29.0i
-11.0)/(5.0+7.0i
) == 2.0+3.0i
? 1 : -1]; // expected-warning {{fold}}
75 int f3
[-(2.0+3.0i
) == +(-3.0i
-2.0) ? 1 : -1]; // expected-warning {{fold}}
76 int f4
[~(2.0+3.0i
) == 2.0-3.0i
? 1 : -1]; // expected-warning {{fold}}
77 int f5
[(3.0i
== -(-3.0i
) ? ((void)3.0, __extension__ (1.0i
- 1.0)) : 0) == 1.0i
- 1.0 ? 1 : -1]; // expected-warning {{fold}}