Jonathan Wakely [Wednesday, 9 September 2026, 22:15:20 CEST]: > On Wed, 9 Sept 2026 at 20:53, Iain Sandoe <[email protected]> wrote: > > Tested on x86_64, aarch64-linux and on x86_64-darwin. > > At present (on Darwin), fixing this issue exposes PR126811 (but that's a > > C++ FE change to fix and not included here). OK for trunk? > > Looks OK to me, please give Matthias a chance to comment and commit if > he doesn't respond :-)
I already gave my go ahead in PR126811. This implements what I intended the behavior to be. - Matthias > > > thanks > > Iain > > > > --- 8< --- > > > > 14 simd testcases fail to build on Darwin because math_errhandling is a > > macro that resolves to a function, rather than a constant. At present > > the macro is present in a non-dependent requires clause and so is not > > substituted. We need this to SFINAE in the immediate context. > > > > Solution proposed here is to use the macro as a default template argument > > instead. > > > > PR libstdc++/126807 > > > > libstdc++-v3/ChangeLog: > > * include/bits/simd_details.h: Make the math_errhandling > > macro into a default template argument. > > > > Signed-off-by: Iain Sandoe <[email protected]> > > --- > > > > libstdc++-v3/include/bits/simd_details.h | 8 +++++--- > > 1 file changed, 5 insertions(+), 3 deletions(-) > > > > diff --git a/libstdc++-v3/include/bits/simd_details.h > > b/libstdc++-v3/include/bits/simd_details.h index a3ec38f0dc0..46eab585eb9 > > 100644 > > --- a/libstdc++-v3/include/bits/simd_details.h > > +++ b/libstdc++-v3/include/bits/simd_details.h > > @@ -422,12 +422,14 @@ namespace simd > > > > // math_errhandling may expand to an extern symbol, in which case we > > must assume fp exceptions // need to be considered. A conforming C > > library must define math_errhandling, but in case it // isn't defined > > we simply use the fallback. > > > > + // The macro is used as default template argument (rather than in a > > requires-clause) so that a + // non-constant math_errhandling is a > > substitution failure in the immediate context instead of a + // hard > > error at the point of definition. > > > > #ifdef math_errhandling > > > > - template <int = 0> > > - requires requires { typename bool_constant<0 != (math_errhandling & > > MATH_ERREXCEPT)>; } + template <int _ErrHandling = math_errhandling> > > > > consteval bool > > __handle_fpexcept_impl(int) > > > > - { return 0 != (math_errhandling & MATH_ERREXCEPT); } > > + { return 0 != (_ErrHandling & MATH_ERREXCEPT); } > > > > #endif > > > > // Fallback if math_errhandling doesn't work: implement correct > > exception behavior.> > > -- > > 2.50.1 (Apple Git-155) -- ────────────────────────────────────────────────────────────────────────── Dr. Matthias Kretz https://mattkretz.github.io GSI Helmholtz Center for Heavy Ion Research https://gsi.de std::simd ──────────────────────────────────────────────────────────────────────────
