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

            Bug ID: 123964
           Summary: [reflection] parameters_of(^^function_type) produces a
                    vector of unusable reflections
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: boris.staletic at protonmail dot com
  Target Milestone: ---

Created attachment 63580
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=63580&action=edit
preprocessed snippet

The standard says that parameters_of(^^int(int, long)) should return a
vector{^^int, ^^long}.
https://eel.is/c++draft/meta.reflection.queries#62.2
It stands to reason then that `parameters_of(^^int(int, long))[0]` should be
the same as `^^int`, but that does not work. Nor does `is_type` return true.

Example code:
```
#include <meta>

static_assert(^^int == std::meta::parameters_of(^^int(int))[0]);
static_assert(std::meta::is_type(std::meta::parameters_of(^^int(int))[0]));
[:std::meta::parameters_of(^^int(int))[0]:] int_var = 4;
constexpr auto x = [:std::meta::parameters_of(^^int(int))[0]:];
```

Both asserts fail.
The first splice says "expected unqualified-id before [:"
And the last line SEGFAULTS.

What does work is `parameters_of(^^function) |
std::views::transform(std::meta::type_of)`

Reply via email to