xref: /llvm-project/clang/test/C/drs/dr206.c (revision cce06da1ecf789658551ca5f3b255c361f063abf)
1 /* RUN: %clang_cc1 -std=c89 -Wno-deprecated-non-prototype -ast-dump -o -  %s | FileCheck %s
2    RUN: %clang_cc1 -std=c99 -Wno-deprecated-non-prototype -ast-dump -o -  %s | FileCheck %s
3    RUN: %clang_cc1 -std=c11 -Wno-deprecated-non-prototype -ast-dump -o -  %s | FileCheck %s
4    RUN: %clang_cc1 -std=c17 -Wno-deprecated-non-prototype -ast-dump -o -  %s | FileCheck %s
5  */
6 
7 /* WG14 DR206: yes
8  * Default argument conversion of float _Complex
9  */
10 void dr206_unprototyped();
dr206(void)11 void dr206(void) {
12   /* Ensure that _Complex float is not promoted to _Complex double but is
13    * instead passed directly without a type conversion.
14    */
15   _Complex float f = 1.2f;
16   dr206_unprototyped(f);
17   // CHECK: CallExpr 0x{{.*}} <line:16:3, col:23> 'void'
18   // CHECK-NEXT: ImplicitCastExpr 0x{{.*}} <col:3> 'void (*)()' <FunctionToPointerDecay>
19   // CHECK-NEXT: DeclRefExpr 0x{{.*}} <col:3> 'void ()' Function 0x{{.*}} 'dr206_unprototyped' 'void ()'
20   // CHECK-NEXT: ImplicitCastExpr 0x{{.*}} <col:22> '_Complex float' <LValueToRValue>
21   // CHECK-NEXT: DeclRefExpr 0x{{.*}} <col:22> '_Complex float' lvalue Var 0x{{.*}} 'f' '_Complex float'
22 }
23 
24