https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110581
Bug ID: 110581
Summary: Weird error message for returning from a [[noreturn]]
function in constant evaluation
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Keywords: diagnostic
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: de34 at live dot cn
Target Milestone: ---
GCC rejects the following code snippet since GCC14, which is correct because
the code raises UB in constant evaluation (https://godbolt.org/z/neP1MKnxY)
[[noreturn]] constexpr void unreachable_like() {}
constexpr int x = (unreachable_like(), 0);
However, the current error message is weird and possibly misleading:
> error: lvalue-to-rvalue conversion of a volatile lvalue 'unreachable_like'
> with type 'void()'
We should say something about `[[noreturn]]` insead superfluous `volatile`.