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

--- Comment #8 from Jason Merrill <jason at gcc dot gnu.org> ---
Author: jason
Date: Tue Nov  5 23:53:53 2019
New Revision: 277864

URL: https://gcc.gnu.org/viewcvs?rev=277864&root=gcc&view=rev
Log:
Fix conversions for built-in operator overloading candidates.

While working on C++20 operator<=>, I noticed that build_new_op_1 was doing
too much conversion when a built-in candidate was selected; the standard
says it should only perform user-defined conversions, and then leave the
normal operator semantics to handle any standard conversions.  This is
important for operator<=> because a comparison of two different unscoped
enums is ill-formed; if we promote the enums to int here, cp_build_binary_op
never gets to see the original operand types, so we can't give the error.

I'm also disabling -Wmaybe-uninitialized for expmed.c to avoid the bootstrap
failure from the last time I applied this patch.

        * call.c (build_new_op_1): Don't apply any standard conversions to
        the operands of a built-in operator.  Don't suppress conversions in
        cp_build_unary_op.
        * typeck.c (cp_build_unary_op): Do integral promotions for enums.

        PR tree-optimization/91825
        * expmed.c: Reduce -Wmaybe-uninitialized to warning.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/call.c
    trunk/gcc/cp/typeck.c
    trunk/gcc/expmed.c

Reply via email to