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

            Bug ID: 123660
           Summary: [reflection] Cannot make a pointer to member from a
                    reflection of a type template argument
           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 63375
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=63375&action=edit
Preprocessed snippet

The following snippet

```
#include <meta>

template<typename T>
auto test_address_of_spliced_member(T) {
    constexpr auto m =nonstatic_data_members_of(^^T,
std::meta::access_context::current())[0]; 
    &[:m:];
}
struct Test{int x;};
int main() {
    Test t;
    test_address_of_spliced_member(t);
}
```

Errors with

```
example.cpp: In instantiation of 'auto test_address_of_spliced_member(T) [with
T = Test]':
required from here
example.cpp:11:35:   
   11 |     test_address_of_spliced_member(t);
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
example.cpp:6:5: error: lvalue required as unary '&' operand
    6 |     &[:m:];
      |     ^~~~~~
Compiler returned: 1
```

Reply via email to