[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
Fri Mar 6 01:01:21 GMT 2026


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

--- Comment #1 from friedkeenan at protonmail dot com ---
I should add that the following code also compiles successfully when removing
the templating of the function:
```
#include <meta>

void function(int original_name);

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

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

static_assert(not has_identifier(
    parameters_of(^^function)[0]
));
```
Godbolt link: https://godbolt.org/z/j7fzKzh5b


More information about the Gcc-bugs mailing list