diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp --- a/clang/lib/Parse/ParseDecl.cpp +++ b/clang/lib/Parse/ParseDecl.cpp @@ -2178,8 +2178,23 @@ } P.Actions.ActOnCXXEnterDeclInitializer(S, ThisDecl); } + auto ThisVarDecl = dyn_cast_or_null(ThisDecl); + if (ThisVarDecl) { + FPOptionsOverride NewFPFeatures; + NewFPFeatures.setRoundingModeOverride(llvm::RoundingMode::NearestTiesToEven); + P.Actions.FpPragmaStack.Act(ThisDecl->getLocation(), + Sema::PSK_Push_Set, StringRef(), NewFPFeatures); + } + } + ~InitializerScopeRAII() { + pop(); + auto ThisVarDecl = dyn_cast_or_null(ThisDecl); + if (ThisVarDecl) { + FPOptionsOverride NewFPFeatures; + P.Actions.FpPragmaStack.Act(SourceLocation(), + Sema::PSK_Pop, StringRef(), NewFPFeatures); + } } - ~InitializerScopeRAII() { pop(); } void pop() { if (ThisDecl && P.getLangOpts().CPlusPlus) { Scope *S = nullptr;