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

Barry Revzin <barry.revzin at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |barry.revzin at gmail dot com

--- Comment #1 from Barry Revzin <barry.revzin at gmail dot com> ---
Shorter:

#include <meta>

struct Test {
    int a;
    char b;
};

consteval auto number_of_members(std::meta::info ty) -> size_t {
    return nonstatic_data_members_of(ty,
std::meta::access_context::current()).size();
}

static_assert(number_of_members(^^Test) == 2); // gcc, clang: ok
static_assert(number_of_members(^^Test const) == 2); // clang: 2, gcc 0

gcc thinks const class types don't have members, but given that you can do
scope resolution on a const class type, I think this should work. 

Real question is whether the actual wording needs to explicitly say "possibly
cv" somewhere in [meta.reflection.member.queries]. That I don't know.

Reply via email to