Index: clang/lib/CodeGen/CodeGenFunction.cpp =================================================================== --- clang/lib/CodeGen/CodeGenFunction.cpp +++ clang/lib/CodeGen/CodeGenFunction.cpp @@ -161,6 +161,7 @@ assert((CGF.CurFuncDecl == nullptr || CGF.Builder.getIsFPConstrained() || isa(CGF.CurFuncDecl) || isa(CGF.CurFuncDecl) || + isa(CGF.CurFuncDecl) || (NewExceptionBehavior == llvm::fp::ebIgnore && NewRoundingBehavior == llvm::RoundingMode::NearestTiesToEven)) && "FPConstrained should be enabled on entire function"); Index: clang/test/CodeGen/pragma-fenv_access.cpp =================================================================== --- /dev/null +++ clang/test/CodeGen/pragma-fenv_access.cpp @@ -0,0 +1,71 @@ +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fcxx-exceptions \ +// RUN: -fexceptions -emit-llvm -o - %s | FileCheck %s + +// expected-no-diagnostics + +char b; +template using d = c; +template void e(); +template auto g(f k) { auto pt = *k; } +class n { +public: + n(char *); +}; +template using i = aa; +template constexpr bool j = true; +struct o { + using l = char; + using ac = l *; +}; +template class p { +public: + m ad; +}; +template struct ae; +template class q { +public: + using ac = o::ac; + void r() { g(af.h); } + struct { + ac h; + } af; +}; +class s { + using ag = i; + using ah = q, o, ae>>; + +public: + s(char *); + char *t() { ai.ad.r(); } + p ai; +}; +using aj = s; +class ak : n { +public: + using al = n; + ak(aj k) : al(k.t()) {} +}; +class u : ak { +protected: + u() : ak(0) {} +}; +class am : u {}; +class v { +public: + class w : am { + public: + w(aj) {} + }; +}; +class x : v { +protected: + void y() { throw w(&b); } +}; +class z : x { +public: + z() { y(); } +}; +#pragma STDC FENV_ACCESS ON +void a() { z(); } + +// CHECK: define dso_local void @_Z1av()