Make test more lenient for custom clang version strings
[llvm-project.git] / clang / test / C / C99 / n809_2.c
blob3bf163126521a619aa39b912cc9af6cae3dc8761
1 // RUN: %clang_cc1 -ast-dump -std=c99 %s | FileCheck %s
3 void variadic(int i, ...);
5 void func(void) {
6 // CHECK: FunctionDecl {{.*}} func 'void (void)'
8 // Show that we correctly convert between two complex domains.
9 _Complex float cf = 1.0f;
10 _Complex double cd;
12 cd = cf;
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'
19 cf = cd;
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).
29 (void)(cf + 1.0);
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
37 // _Complex double.
38 (void)(cd + 1.0f);
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
46 // _Complex float.
47 (void)(cf + 1);
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.
56 variadic(1, cf);
57 // CHECK: CallExpr
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'