On 9/12/24 7:23 AM, Simon Martin wrote:
Hi,

While looking at more open PRs, I have discovered that the problem
reported in PR109790 is very similar to that in PR100632, so I’m
combining both in a single patch attached here. The fix is similar to

the one I initially submitted, only more general and I believe better.

We currently crash upon mangling members that have an anonymous union
or a template type.

The problem is that before calling write_unqualified_name,
write_member_name has an assert that assumes that it has an
IDENTIFIER_NODE in its hand. However it's incorrect: it has an
anonymous union in PR100632, and a template in PR109790.

The assert does not assume it has an IDENTIFIER_NODE; it assumes it has a _DECL, and expects its DECL_NAME to be an IDENTIFIER_NODE.

!identifier_p will always be true for a _DECL, making the assert useless.

How about checking !DECL_NAME (member) instead of !identifier_p?

This patch fixes this by relaxing the assert to accept members that are
not identifiers, that are handled by write_unqualified_name just fine.


Reply via email to