Date: Tue, 10 Feb 2026 12:46:52 +0100
> Since when is the existing always_inline a mere hint? And since when
> is it a request that emits a mere warning if the compiler fails to do
> what it's told
> to do by that attribute? I mean other than for indirect calls.
>
[[gnu::always_inline]] is treated as an ignorable hint by Clang. See
https://godbolt.org/z/exTed6zWY See
https://clang.llvm.org/docs/AttributeReference.html#always-inline-force-inline
Maybe there is a way to get Clang to issue a warning when
[[gnu::always_inline]] is being ignored; it seems like failure is being
silently swept under the rug.
GCC issues an error when it fails to inline with [[gnu::always_inline]]
applied.
> Could we perhaps not reinvent the existing attributes with the same
> spelling but with a different meaning?
>
Making the attributes ignorable hints would be consistent with Clang, so
it's standardizing existing practice.
It's also similar to how constinit works (
https://eel.is/c++draft/dcl.constinit#2). constinit is stated to make the
program ill-formed when dynamic initialization happens, without imposing
any change in semantics to initialization (e.g. making things
constant-evaluated that otherwise wouldn't be). It's just a means of
diagnosing accidental dynamic initialization, just like, say, a standard
[[nrvo]] would diagnose an accidental failure to perform NRVO.
Of course, one of these results in an error and the other in a warning, but
there's really no reason why we couldn't have had a [[constinit]] attribute
in that style, and you could achieve the same effect using -Werror=...
after all.
> is it a request that emits a mere warning if the compiler fails to do
> what it's told
> to do by that attribute? I mean other than for indirect calls.
>
[[gnu::always_inline]] is treated as an ignorable hint by Clang. See
https://godbolt.org/z/exTed6zWY See
https://clang.llvm.org/docs/AttributeReference.html#always-inline-force-inline
Maybe there is a way to get Clang to issue a warning when
[[gnu::always_inline]] is being ignored; it seems like failure is being
silently swept under the rug.
GCC issues an error when it fails to inline with [[gnu::always_inline]]
applied.
> Could we perhaps not reinvent the existing attributes with the same
> spelling but with a different meaning?
>
Making the attributes ignorable hints would be consistent with Clang, so
it's standardizing existing practice.
It's also similar to how constinit works (
https://eel.is/c++draft/dcl.constinit#2). constinit is stated to make the
program ill-formed when dynamic initialization happens, without imposing
any change in semantics to initialization (e.g. making things
constant-evaluated that otherwise wouldn't be). It's just a means of
diagnosing accidental dynamic initialization, just like, say, a standard
[[nrvo]] would diagnose an accidental failure to perform NRVO.
Of course, one of these results in an error and the other in a warning, but
there's really no reason why we couldn't have had a [[constinit]] attribute
in that style, and you could achieve the same effect using -Werror=...
after all.
Received on 2026-02-10 11:47:07
