unexpected name_of on alias member
Closed this issue · 1 comments
Pespon commented
Bug Report
name_of return the type name instead of the alias name when used whith alias member infos obtained via members_of.
Also, calling type_of on those alias member do not compile.
To Reproduce
struct bar
{
using int_type = int;
};
int
main(void)
{
std::cout << name_of(members_of(^bar)[0]) << std::endl;
// Do not compile
// std::cout << name_of(type_of(members_of(^bar)[0])) << std::endl;
return 0;
}
Expected behavior
int_type
int
got:
int
Additional context
tested on commit c2764ac
katzdm commented
Also, calling type_of on those alias member do not compile.
I think this is correct behavior. As per D2996R3:
If
r
is already a type,type_of(r)
is not a constant expression.
I agree that name_of(members_of(^bar)[0])
should be int_type
, though - good catch!