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

            Bug ID: 126036
           Summary: [reflection] ICE on assignment members_of into
                    constexpr variable
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: kengusername at proton dot me
  Target Milestone: ---

This program fails to compile on gcc 17 trunk
https://godbolt.org/z/8eqGcsaET

```
#include <meta>
namespace details {
    int a;
};
template<auto = 0> consteval auto gen() {
    constexpr auto range = std::meta::members_of(^^details,
std::meta::access_context::unchecked());
}
```
this example also triggers an ICE:
https://godbolt.org/z/vGYdKnETx
```
#include <meta>
enum xyz {a};

template<auto = 0> consteval auto gen() {
    constexpr auto range = std::meta::enumerators_of(^^xyz);
}
```

However it fails properly without templates:
https://godbolt.org/z/4zrhxbGTb

```
#include <meta>
namespace details {
    int a;
};
consteval auto gen() {
    constexpr auto range = std::meta::members_of(^^details,
std::meta::access_context::unchecked());
}

```

This suggests that this is an issue with the way metafunctions return vectors.
All of these examples behave the same way on gcc 16.1 with assertions.

Reply via email to