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

            Bug ID: 125007
           Summary: [reflection] static_assert error message treats a
                    reflection of an annotation as a reflection of
                    constant
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Keywords: c++26
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: alexey.saldyrkine at gmail dot com
  Target Milestone: ---

Not sure if this is a bug or if this is the place to report it.
The error message says "comparison reduces to '(^^1 == ^^1)'", even though the
first argument in the static assert is a reflection of an annotation.
This can be confusing, as at a glance it looks like the static assert failed
when it shouldn't have.

I don't know how it's decided what an error message should say, 
but it would be less confusing if it said something like '(^^[[=1]] == ^^1)' 
or simply '(^^annotation == ^^1)'.

```
#include <meta>
using namespace std::meta;

struct [[=1]] A{
};

static_assert(annotations_of(^^A).size() == 1);
static_assert(constant_of(annotations_of(^^A)[0]) == reflect_constant(1));
static_assert(annotations_of(^^A)[0] == reflect_constant(1)); // Here

int main(){  
}
```

```
<source>:9:38: error: static assertion failed
    9 | static_assert(annotations_of(^^A)[0] == reflect_constant(1));
  • the comparison reduces to '(^^1 == ^^1)'
Compiler returned: 1
```

Reply via email to