https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124239
Bug ID: 124239
Summary: [reflection] Add warning for ambiguous parse with ^^
and &&
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Keywords: diagnostic
Severity: enhancement
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: nshead at gcc dot gnu.org
Blocks: 123615
Target Milestone: ---
Consider the following:
constexpr auto a = ^^int;
constexpr bool b = a == ^^int && true;
We currently give the following diagnostic:
<source>:2:34: error: expected ',' or ';' before 'true'
2 | constexpr bool b = a == ^^int && true;
| ^~~~
This is correct by https://eel.is/c++draft/expr.reflect#3 but the diagnostic is
perhaps confusing. It would be nice to provide a note to indicate that the
`&&` has been parsed as part of the reflect-expression.
Referenced Bugs:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123615
[Bug 123615] (c++-reflection) - [meta-bug] reflection issue