[Bug c++/124685] New: [reflection] annotation with pointer to function template specialization rejected

mfwippich at gmail dot com gcc-bugzilla@gcc.gnu.org
Sun Mar 29 18:46:19 GMT 2026


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

            Bug ID: 124685
           Summary: [reflection] annotation with pointer to function
                    template specialization rejected
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mfwippich at gmail dot com
  Target Milestone: ---

Consider
```
template <typename> void f() {}
static_assert([:std::meta::reflect_constant(f<int>):] == &f<int>);
[[= &f<int>]] void g(); // error
```

This currently errors with a bogus diagnostic
> <source>:6:22: error: annotation does not have structural type
>    6 | [[= &f<int>]] void g(); // error

This code should be accepted - pointers are structural types.

Here's a more complete example: https://compiler-explorer.com/z/3x5ea6E71


More information about the Gcc-bugs mailing list