On Fri, 19 Dec 2025 at 09:34, Andrew Pinski <[email protected]> wrote: > > On Fri, Dec 19, 2025 at 1:28 AM Jakub Jelinek <[email protected]> wrote: > > > > Hi! > > > > This is something Jonathan has asked for recently. E.g. in the recent > > libstdc++ r16-6177 random.tcc changes, there was > > if constexpr (__d <= 32) > > return __generate_canonical_any<_RealT, uint64_t, __d>(__urng); > > else > > { > > #if defined(__SIZEOF_INT128__) > > static_assert(__d <= 64, > > "irregular RNG with float precision >64 is not supported"); > > return __generate_canonical_any< > > _RealT, unsigned __int128, __d>(__urng); > > #else > > static_assert(false, "irregular RNG with float precision" > > " >32 requires __int128 support"); > > #endif > > } > > and when we hit there the static_assert, we don't get just an error about > > that, but also a -Wreturn-type warning in the same function because that > > path falls through to the end of function without returning a value. > > But a function with a failed static_assert is erroneous and will never > > fall through to the end. We could treat failed static_assert in functions > > as __builtin_unreachable (), but I think it doesn't matter where exactly > > in a function static_assert(false); appears, so this patch just suppresses > > -Wreturn-type warning in that function instead. > > > > Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? > > This fixes PR 91388 (though not PR 119149).
Oh I forgot I'd already reported this before I asked Jakub about it the other day!
