The following source code pattern causes GCC to write some structures as anonymous in the DWARF:
#define USE_VIRTUAL
#define USE_ARRAY
struct t1
{
typedef struct
{
} t2;
#ifdef USE_VIRTUAL
virtual void f1();
#endif
};
t1::t2 v1
#ifdef USE_ARRAY
[1]
#endif
;
This is NOT supposed to happen. It's a bug in GCC.
https://lists.dwarfstd.org/pipermail/dwarf-discuss/2024-December/002573.html