[C++ PATCH] Fix implicit assignment operators with anonymous aggregates

Jason Merrill jason@redhat.com
Tue Mar 20 18:00:00 GMT 2001


>>>>> "Jakub" == Jakub Jelinek <jakub@redhat.com> writes:

> The testcase below results in error (and it did not in g++ 2.95.x), while I
> think it is completely valid. It B does not have a trivial assignment
> operator, everything compiles fine (A's assignment operator ends up
> immediate call to build (MODIFY_EXPR, ...)). The problem is that
> fixup_anonymous_aggr removes the assignment operator method, but
> build_modify_expr requires it, so it dies on anonymous union's operator= not
> being accessible.

I think I'd rather handle this in build_modify_expr; it should be a simple
matter of an additional test to avoid going to build_opfncall.

> For anonymous unions both should IMHO work right, I'm not sure about
> anonymous structures:
> I don't think we disallow anonymous structure's members to have explicit
> operator=

Hmm, if we don't we probably should.

Jason



More information about the Gcc-patches mailing list