https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127002
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Thinking more about type aliases, in the local case one can have several of the
same name, so that needs to use discriminators too:
template <auto N>
void foo ();
consteval auto
bar (bool x)
{
if (x)
{
using A = int; return ^^A;
}
else
{
using A = int; return ^^A;
}
}
void
baz ()
{
foo <bar (false)> ();
foo <bar (true)> ();
}
So perhaps
::= en <enum name> <unqualified-name> # enumerator
::= ta <alias name> _ <type> # type alias
::= dm <class name> <unqualified-name> # ns data member
::= da <class name> [ <nonnegative number> ] _ # empty anon
union
# data member
::= un <class name> [ <nonnegative number> ] _ # unnamed
bitfld
Except we can't use write_name (or at least not write_name as is), because it
starts with
if (TREE_CODE (decl) == TYPE_DECL)
{
/* In case this is a typedef, fish out the corresponding
TYPE_DECL for the main variant. */
decl = TYPE_NAME (TYPE_MAIN_VARIANT (TREE_TYPE (decl)));
}
and we have to avoid that for the reflections of type aliases.