Skip to content

CWG3108 [expr.reflect] ^^type-id vs. type aliases #789

Description

@jakubjelinek

Full name of submitter (unless configured in github; will be published with the issue): Jakub Jelinek

Reference (section label): [expr.reflect]/6

Link to reflector thread (if any):

Issue description: The http://eel.is/c++draft/expr.reflect#6 wording only talks about specialization of an alias template as a way to get a type alias, but the examples later on and in https://eel.is/c++draft/basic.fundamental#example-2 show that ^^Alias where Alias is a typedef/using is a type alias.
In any case, it is unclear what exact type-ids should result in is_type_alias and what not.
https://godbolt.org/z/bdW5YGndc

#include <meta>

typedef int I;
static_assert (is_type_alias (^^I));
static_assert (!is_type_alias (^^const I));
static_assert (^^I != ^^int);
static_assert (^^const I == ^^const int);

typedef const int J;
static_assert (is_type_alias (^^J));
static_assert (!is_type_alias (^^const J));
static_assert (^^J != ^^const int);
static_assert (^^const J == ^^const int);

I'd think all this should pass, but the clang++ branch fails the first and third assert in the second block which is weird, ^^J IMHO is a type alias, what else? I'd think ^^const I shouldn't be a type alias because the reflection doesn't represent the type alias but its cv qualified version, but less sure about the ^^const J case where the type alias already contains the const; so, the only way to make ^^const J not a type alias would be during parsing of the type-id note that there are extra quals.

Suggested resolution:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions