Skip to content

Commit b90d9ae

Browse files
author
git apple-llvm automerger
committed
Merge commit 'f1d5ea362577' from llvm.org/release/17.x into stable/20230725
2 parents 65355cd + f1d5ea3 commit b90d9ae

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

clang/lib/Sema/TreeTransform.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7478,6 +7478,10 @@ StmtResult
74787478
TreeTransform<Derived>::TransformCompoundStmt(CompoundStmt *S,
74797479
bool IsStmtExpr) {
74807480
Sema::CompoundScopeRAII CompoundScope(getSema());
7481+
Sema::FPFeaturesStateRAII FPSave(getSema());
7482+
if (S->hasStoredFPFeatures())
7483+
getSema().resetFPOptions(
7484+
S->getStoredFPFeatures().applyOverrides(getSema().getLangOpts()));
74817485

74827486
const Stmt *ExprResult = S->getStmtExprResult();
74837487
bool SubStmtInvalid = false;

clang/test/SemaCXX/template-64605.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// RUN: %clang_cc1 -ast-dump -ast-dump-filter=b_64605 %s | FileCheck %s
2+
3+
// https://github.com/llvm/llvm-project/issues/64605
4+
5+
#pragma STDC FENV_ACCESS ON
6+
template <typename>
7+
int b_64605() {
8+
int x;
9+
if ((float)0xFFFFFFFF != (float)0x100000000) {
10+
x = 1;
11+
}
12+
return x;
13+
}
14+
int f() { return b_64605<void>(); }
15+
16+
// CHECK: ImplicitCastExpr {{.*}} 'float' <IntegralToFloating> RoundingMath=1 AllowFEnvAccess=1
17+
// CHECK-NEXT: IntegerLiteral {{.*}} 4294967295
18+
19+
// CHECK: FunctionDecl {{.*}} b_64605 'int ()' implicit_instantiation
20+
// CHECK-NEXT: TemplateArgument type 'void'
21+
22+
// CHECK: ImplicitCastExpr {{.*}} 'float' <IntegralToFloating> RoundingMath=1 AllowFEnvAccess=1
23+
// CHECK-NEXT: IntegerLiteral {{.*}} 4294967295

0 commit comments

Comments
 (0)