https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124474
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 63945
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=63945&action=edit
gcc16-pr124474.patch
Of course it is.
The following untested patch fixes that (but I'm afraid I have no easy way to
test it on arm32).
That said, not sure if it is useful to check_out_of_consteval_use on the body
of functions/methods for which we've already diagnosed consteval-only errors.
E.g. in methods of consteval-only types this will have consteval-only type and
anything that uses it will have too.
Consider:
struct A {
decltype (^^::) a = ^^::;
int b;
void foo ();
};
void A::foo ()
{
++b;
}
pr124474.C:4:8: error: function of consteval-only type must be declared
‘consteval’
4 | void foo ();
| ^~~
pr124474.C: In member function ‘void A::foo()’:
pr124474.C:8:6: error: consteval-only expressions are only allowed in a
constant-evaluated context
8 | ++b;
| ^
The second error seems to be kind of superfluous already. Or at least ignore
this and its dereferences in methods of consteval-only types?