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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |msebor at gcc dot gnu.org
         Resolution|---                         |INVALID

--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
I believe the test case is invalid.

In a call to an operator, operator overload resolution in [over.match.oper]
considers three sets of candidate functions:
1) member candidates (operators defined as members one of the operands)
2) non-member candidates (only non-member functions are considered)
3) built-in candidates (operators that take types to which the operands can be
converted)

In the test case, sets (1) and (2) are obviously empty.  Set (3) is also empty
because there is no well-formed implicit conversion sequence ([over.best.ics])
from Z1 to int (the conversion exists but would require two user-defined
conversions, one from Z1 to Z and another from Z to int; such conversions are
not well-formed).

Like GCC, both Clang 3.8 and EDG eccp 3.11 also reject the program.

The expression "Z(x0)+Z(x1)" is valid because the types of the operands are Z
and thus do not require the second implicit user-defined conversion that makes
set (3) above empty.

Reply via email to