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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
                 CC|                            |jakub at gcc dot gnu.org,
                   |                            |mpolacek at gcc dot gnu.org
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2026-01-24

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Reduced testcase:
#include <meta>

struct S {
  typedef enum { A, B } C;
};
int a = members_of (^^S, std::meta::access_context::unchecked ()).size ();

The problem is that there are two TYPE_DECLs, one is for the anonymous enum but
its TREE_TYPE is ENUMERAL_TYPE C, and another one i C with the same TREE_TYPE.
class_members_of puhses into the vector for TYPE_DECLs their TREE_TYPE, so
pushes twice the same thing, and the assertions is to make sure nothing appears
more than once in there.

Anyway, this leads to further questions.
Should
#include <meta>

typedef enum { A, B } C;
static_assert (is_type_alias (^^C));
pass or not?  It does on the clang reflection branch, it doesn't in GCC.  When
a typedef gives name for linkage purposes to an anonymous enum/class/union,
that is the enum/class/union type rather than its typedef variant.

Reply via email to