[Bug c++/124382] [reflection] Erroneous result of std::meta::has_identifier with parameter of a specialized function template following friend injection

friedkeenan at protonmail dot com gcc-bugzilla@gcc.gnu.org
Sun Mar 8 09:43:12 GMT 2026


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

--- Comment #2 from friedkeenan at protonmail dot com ---
Another similar test case fails if you move the templating on the function to
instead be on an enclosing class:
```
#include <meta>

template<typename>
struct enclosing_class {
    static void function(int original_name);
};

template<typename>
struct friendly {
    friend void enclosing_class<int>::function(int friendly_name);
};

/* In order to instantiate the template. */
constexpr inline auto size = sizeof(friendly<int>);

static_assert(not has_identifier(
    parameters_of(^^enclosing_class<int>::function)[0]
));
```
Godbolt link: https://godbolt.org/z/WvdYzP9Pe


More information about the Gcc-bugs mailing list