]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/Sema/complex-int.c
Update clang to r93512.
[FreeBSD/FreeBSD.git] / test / Sema / complex-int.c
1 // RUN: %clang_cc1 %s -verify -fsyntax-only
2
3 void a() {
4 __complex__ int arr;
5 __complex__ short brr;
6 __complex__ unsigned xx;
7 __complex__ signed yy;
8 __complex__ int result;
9 int ii;
10 int aa = 1 + 1.0iF;
11
12 result = arr*ii;
13 result = ii*brr;
14
15 result = arr*brr;
16 result = xx*yy;
17
18 switch (arr) { // expected-error{{statement requires expression of integer type ('_Complex int' invalid)}}
19   case brr: ; // expected-error{{expression is not an integer constant expression}}
20   case xx: ; // expected-error{{expression is not an integer constant expression}}
21 }
22 }
23
24 void Tester() {
25 __complex short a1;
26 __complex int a2;
27 __complex float a3;
28 __complex double a4;
29 short a5;
30 int a6;
31 float a7;
32 double a8;
33 #define TestPair(m,n) int x##m##n = a##m+a##n;
34 #define TestPairs(m) TestPair(m,1) TestPair(m,2) \
35                     TestPair(m,3) TestPair(m,4) \
36                     TestPair(m,5) TestPair(m,6) \
37                     TestPair(m,7) TestPair(m,8)
38 TestPairs(1); TestPairs(2);
39 TestPairs(3); TestPairs(4);
40 TestPairs(5); TestPairs(6);
41 TestPairs(7); TestPairs(8);
42 }
43
44 // rdar://6097730
45 void test3(_Complex int *x) {
46   *x = ~*x;
47 }
48
49 void test4(_Complex float *x) {
50   *x = ~*x;
51 }
52
53 void test5(_Complex int *x) {
54   (*x)++;
55 }