You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[[noreturn]] false positive when calling a [[noreturn]] constructor #218
If a function marked with [[noreturn]] construct an object whose constructor is marked [[noreturn]],
this is not recognized, and an erroneous warning is emitted.
[Front End] This code SHOULD NOTwarn with these options.
Additional Details
In the example, both B::B() and g() cause the warning to be emitted,
and it is clear they can't actually return because of A::A().
Compiler output:
"<source>", line 6: warning: function declared with "noreturn" does return
[[noreturn]] B() { A{}; }
^
"<source>", line 9: warning: function declared with "noreturn" does return
[[noreturn]] void g() { A{}; }
^
Also noting that the attribute on A::A() is not fully ignored,
if we remove the throw it warns there (as expected/correct).
Reproducing (Standard) Configuration(s)
linux-gcc-release
Reproducing (Non-standard) Configuration
No response
I acknowledge that:
I have checked open issues and existing discussions before filing this report.
The reproducing source code that I have provided does not depend on headers that I have not included with my submission.
I have reduced the reproducing source code to the best of my ability.
I have selected at least one standard configuration or uploaded a non-standard configuration dump.
I understand code shared via this form is NOT confidential.
I have permission to share the reproducing source code and grant permission for the project to use the source code (or derivatives of the source code) to create tests.
I agree that any tests created using the reproducing source code (or deriatives of it) will be licensed under project license unless I included a LICENSE.txt file in my .zip or .tar.gz upload. If I included a LICENSE.txt file, any tests created using the reproducing source code will be governed by the terms of the license I provided instead.
@daveedvdv-nvidia Since you merged #225 (appreciate the Changes entry, wasn't aware of it), IMO this can be closed. Unless you wish it remain open for potential future improvements to [[noreturn]].
Activity
daveedvdv-nvidia commentedon Oct 5, 2026
Thanks for reporting this, @ilazaric !
Interested in taking a stab at it?
Suppress `noreturn_function_does_return` warning if noreturn construc…
ilazaric commentedon Oct 6, 2026
Yep, I can take a look.
Suppress `noreturn_function_does_return` warning if noreturn construc…
Suppress `noreturn_function_does_return` warning if noreturn construc…
Suppress `noreturn_function_does_return` warning if noreturn construc…
Merge upstream main (21065e5) into cerastes
ilazaric commentedon Oct 22, 2026
@daveedvdv-nvidia Since you merged #225 (appreciate the
Changesentry, wasn't aware of it), IMO this can be closed. Unless you wish it remain open for potential future improvements to[[noreturn]].daveedvdv-nvidia commentedon Oct 22, 2026
Fix with commit dedc820