xref: /llvm-project/clang/test/C/drs/dr290.c (revision 7c1d9b15eee3a34678addab2bab66f3020ac0753)
1 /* RUN: %clang_cc1 -ast-dump %s | FileCheck %s
2  */
3 
4 /* WG14 DR290: no
5  * FLT_EVAL_METHOD and extra precision and/or range
6  *
7  * We retain an implicit conversion based on the float eval method being used
8  * instead of dropping it due to the explicit cast. See GH86304 and C23 6.5.5p7.
9  */
10 
11 #pragma clang fp eval_method(double)
12 _Static_assert((float)(123.0F * 2.0F) == (float)246.0F, "");
13 
14 // CHECK: StaticAssertDecl
15 // CHECK-NEXT: ImplicitCastExpr {{.*}} '_Bool' <IntegralToBoolean>
16 // CHECK-NEXT: BinaryOperator {{.*}} 'int' '=='
17 // NB: the following implicit cast is incorrect.
18 // CHECK-NEXT: ImplicitCastExpr {{.*}} 'double' <FloatingCast> FPEvalMethod=1
19 // CHECK-NEXT: CStyleCastExpr {{.*}} 'float' <FloatingCast> FPEvalMethod=1
20 
21