diff options
author | Jason Merrill <jason@redhat.com> | 2019-09-16 00:34:18 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2019-09-16 00:34:18 -0400 |
commit | a4d034d714f5799d3038aaf85347923686c7db64 (patch) | |
tree | 74df2a5ace26eaa90aa1fa2b11c5367181549389 /gcc/tree-predcom.c | |
parent | c4438114d6133f4266be57b8678c49badbe60145 (diff) | |
download | gcc-a4d034d714f5799d3038aaf85347923686c7db64.zip gcc-a4d034d714f5799d3038aaf85347923686c7db64.tar.gz gcc-a4d034d714f5799d3038aaf85347923686c7db64.tar.bz2 |
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.
* 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.
From-SVN: r275744
Diffstat (limited to 'gcc/tree-predcom.c')
0 files changed, 0 insertions, 0 deletions