1 // RUN: %clang_cc1 -ast-dump -std=c99 %s | FileCheck %s
3 void variadic(int i
, ...);
6 // CHECK: FunctionDecl {{.*}} func 'void (void)'
8 // Show that we correctly convert between two complex domains.
9 _Complex
float cf
= 1.0f
;
13 // CHECK: BinaryOperator {{.*}} '_Complex double' '='
14 // CHECK-NEXT: DeclRefExpr {{.*}} 'cd'
15 // CHECK-NEXT: ImplicitCastExpr {{.*}} '_Complex double' <FloatingComplexCast>
16 // CHECK-NEXT: ImplicitCastExpr {{.*}} '_Complex float' <LValueToRValue>
17 // CHECK-NEXT: DeclRefExpr {{.*}} 'cf'
20 // CHECK: BinaryOperator {{.*}} '_Complex float' '='
21 // CHECK-NEXT: DeclRefExpr {{.*}} 'cf'
22 // CHECK-NEXT: ImplicitCastExpr {{.*}} '_Complex float' <FloatingComplexCast>
23 // CHECK-NEXT: ImplicitCastExpr {{.*}} '_Complex double' <LValueToRValue>
24 // CHECK-NEXT: DeclRefExpr {{.*}} 'cd'
26 // Show that we correctly convert to the common type of a complex and real.
27 // This should convert the _Complex float to a _Complex double ("without
28 // change of domain" c.f. C99 6.3.1.8p1).
30 // CHECK: BinaryOperator {{.*}} '_Complex double' '+'
31 // CHECK-NEXT: ImplicitCastExpr {{.*}} '_Complex double' <FloatingComplexCast>
32 // CHECK-NEXT: ImplicitCastExpr {{.*}} '_Complex float' <LValueToRValue>
33 // CHECK-NEXT: DeclRefExpr {{.*}} 'cf'
34 // CHECK-NEXT: FloatingLiteral {{.*}} 'double' 1.0
36 // This should convert the float constant to double, then produce a
39 // CHECK: BinaryOperator {{.*}} '_Complex double' '+'
40 // CHECK-NEXT: ImplicitCastExpr {{.*}} '_Complex double' <LValueToRValue>
41 // CHECK-NEXT: DeclRefExpr {{.*}} 'cd'
42 // CHECK-NEXT: ImplicitCastExpr {{.*}} 'double' <FloatingCast>
43 // CHECK-NEXT: FloatingLiteral {{.*}} 'float' 1.0
45 // This should convert the int constant to float, then produce a
48 // CHECK: BinaryOperator {{.*}} '_Complex float' '+'
49 // CHECK-NEXT: ImplicitCastExpr {{.*}} '_Complex float' <LValueToRValue>
50 // CHECK-NEXT: DeclRefExpr {{.*}} 'cf'
51 // CHECK-NEXT: ImplicitCastExpr {{.*}} 'float' <IntegralToFloating>
52 // CHECK-NEXT: IntegerLiteral {{.*}} 'int' 1
54 // Show that we do not promote a _Complex float to _Complex double as part of
55 // the default argument promotions when passing to a variadic function.
58 // CHECK-NEXT: ImplicitCastExpr {{.*}} <FunctionToPointerDecay>
59 // CHECK-NEXT: DeclRefExpr {{.*}} 'variadic'
60 // CHECK-NEXT: IntegerLiteral {{.*}} 'int' 1
61 // CHECK-NEXT: ImplicitCastExpr {{.*}} '_Complex float' <LValueToRValue>
62 // CHECK-NEXT: DeclRefExpr {{.*}} 'cf'