On 2025-07-29 09:26, Jan Beulich wrote:
On 28.07.2025 21:17, Nicola Vetrini wrote:
On 2025-07-28 20:58, Dmytro Prokopchuk1 wrote:
It works.
The violation "non-compliant cast: implicit cast from `void(*)(void*)'
to `void(*)(void*)'" is gone.


Great. Now what would be really useful is a way to abstract this more
nicely (I was able to write this only by looking at the AST). However
noreturn is probably about the only attribute that has a repercussion on
the decl and is safe to cast away, unless I'm mistaken.

Not sure what you mean by "repercussion" here, and hence my remark may be
entirely meaningless, but: const and pure are also examples of
attributes which are safe to cast away, aiui. In fact, given the sheer
number of attributes, I would be surprised if there weren't more.


Not all attributes influence compatibility of declarations. noreturn is a bit special in the sense that gcc and clang don't quite agree on the semantics of its various forms, where we follow clang's perspective. See https://github.com/llvm/llvm-project/issues/113511 for instance, in particular

So I think the only way in which Clang's behavior is diverging from GCC's here is that we don't support an implicit conversion between pointer-to-function and pointer-to-noreturn function. This should presumably behave somewhat like the implicit conversion between pointer to-function and pointer-to-noexcept-function except that it can apparently be performed implicitly in either direction.

But in any case my remark was more about the future than current plans, so there should be no bug here.

--
Nicola Vetrini, B.Sc.
Software Engineer
BUGSENG (https://bugseng.com)
LinkedIn: https://www.linkedin.com/in/nicola-vetrini-a42471253

Reply via email to