1// RUN: %clang_cc1 -emit-llvm-only %s
2
3int main(void)
4{
5  double _Complex a = 5;
6  double _Complex b = 42;
7
8  return a * b != b * a;
9}
10
11_Complex double bar(int);
12void test(_Complex double*);
13void takecomplex(_Complex double);
14
15void test2(int c) {
16  _Complex double X;
17  X = bar(1);
18  test(&X);
19  takecomplex(X);
20}
21
22_Complex double g1, g2;
23_Complex float cf;
24double D;
25
26void test3() {
27  g1 = g1 + g2;
28  g1 = g1 - g2;
29  g1 = g1 * g2;
30  g1 = +-~g1;
31
32  double Gr = __real g1;
33
34  cf += D;
35  // FIXME: Currently unsupported!
36  //D += cf;
37  cf /= g1;
38  g1 = g1 + D;
39  g1 = D + g1;
40}
41
42__complex__ int ci1, ci2;
43__complex__ short cs;
44int i;
45void test3int() {
46  ci1 = ci1 + ci2;
47  ci1 = ci1 - ci2;
48  ci1 = ci1 * ci2;
49  ci1 = +-~ci1;
50
51  i = __real ci1;
52
53  cs += i;
54  // FIXME: Currently unsupported!
55  //D += cf;
56  cs /= ci1;
57  ci1 = ci1 + i;
58  ci1 = i + ci1;
59}
60
61void t1() {
62  (__real__ cf) = 4.0;
63}
64
65void t2() {
66  (__imag__ cf) = 4.0;
67}
68
69// PR1960
70void t3() {
71  __complex__ long long v = 2;
72}
73
74// PR3131
75float _Complex t4();
76
77void t5() {
78  float _Complex x = t4();
79}
80
81void t6() {
82  g1++;
83  g1--;
84  ++g1;
85  --g1;
86  ci1++;
87  ci1--;
88  ++ci1;
89  --ci1;
90}
91
92// <rdar://problem/7958272>
93double t7(double _Complex c) {
94  return __builtin_fabs(__real__(c));
95}
96
97void t8() {
98  __complex__ int *x = &(__complex__ int){1};
99}
100