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

--- Comment #2 from Jan Schultke <janschultke at googlemail dot com> ---
I think the problem is that GCC treats "constinit" exactly like "const" for the
purpose of diagnostics. In https://eel.is/c++draft/dcl.fct#11, it is said that
const applied to functions is ignored.

GCC produces error messages like:
> <source>:1:1: error: 'constinit' on function return type is not allowed
>     1 | constinit void foo();
>       | ^~~~~~~~~

This does not make any sense; "constinit" wouldn't apply to the function return
type in the first place, but to the declarator-id. See
https://eel.is/c++draft/dcl.meaning.general#4

Reply via email to