[Bug c++/61379] __attribute__((noreturn)) ignored on pure virtual member functions

dragonroot at gmail dot com gcc-bugzilla@gcc.gnu.org
Tue Mar 24 22:04:18 GMT 2026


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61379

Konstantin Isakov <dragonroot at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dragonroot at gmail dot com

--- Comment #7 from Konstantin Isakov <dragonroot at gmail dot com> ---
The logical solution here would be to assume that a virtual [[noreturn]] does
in fact not return (at least not output a warning diagnostic), but instead warn
when a [[noreturn]] virtual function is overridden with one without
[[noreturn]]. So, essentially trade one diagnostic for another.

As for the whether [[noreturn]] is part of type or not, this is a mere warning
we're talking about here. Sure, maybe the compiler shouldn't assume that
[[noreturn]] is in fact a binding guarantee here and base optimizations on
that, but as far as warnings go, they are supposed to be useful, and the
current behavior simply isn't. Also, clang does honor [[noreturn]] on virtual
functions.


More information about the Gcc-bugs mailing list