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

            Bug ID: 126599
           Summary: [reflection]
                    display_string_of(nullptr-pointer-to-data-member) is
                    "-1"
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ivan.lazaric.gcc at gmail dot com
  Target Milestone: ---

```cpp
#include <meta>

struct S;

consteval {
    int S::* ptr = nullptr;
    auto refl = std::meta::reflect_constant(ptr);
    __builtin_constexpr_diag(1, "", display_string_of(refl));
}
```

Compiler output:
```
<source>:8:29: warning: constexpr message: -1
```

Flags: "-std=c++26 -freflection"

Godbolt: https://godbolt.org/z/K7e4ce6b5

IIUC gcc internally represents nullptr pointers-to-data-members as -1,
but more user-friendly output might be "0", or "nullptr".

Reply via email to