<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/124260>124260</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Clang Accepts Ambiguous Conditional Expressions Involving Deleted Functions
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          ckwastra
      </td>
    </tr>
</table>

<pre>
    Clang accepts the following code ([Godbolt](https://godbolt.org/z/ejs7GK9Kb)):

```cpp
#include <type_traits>
#include <utility>
using namespace std;

struct S {
 S(int) = delete;
  operator int();
};

// Clang: T = int, GCC/MSVC: <Ambiguous>
using T = decltype(true ? declval<S>() : declval<int>());
static_assert(is_same_v<T, int>);
```

The conditional expression in this code is ambiguous because there exists an implicit conversion sequence (ICS) from `S` to `int` and another one in the opposite direction, resulting in an ill-formed program according to [[expr.cond]/4](https://timsong-cpp.github.io/cppwp/n4950/expr.cond#4):

> [...] If both sequences can be formed, or one can be formed but it is the ambiguous conversion sequence, the program is ill-formed. [...]

Clang appears to take `delete` into account when forming ICSs, which contradicts the guidance in [Note 2](https://timsong-cpp.github.io/cppwp/n4950/expr.cond#note-2) of the standard:

> Properties such as access, whether an operand is a bit-field, or whether a conversion function is deleted are ignored for that determination.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJysVU1v4zYQ_TX0ZRBDJv158CGRV4tg0aKAg14DihxL3KVJlRw5u_31xVC2k233WEBAYnE4896bNyOds-sC4l6snsTqMNMj9THtzbc3nSnpWRvtj33tdehAG4MDZaAe4RS9j28udGCiRRByK1ZPn6NtoyexOgi57YmGLNSjkI2QTTcdzWPqhGz-FrLBr3nz-cvuSyvkjh_1KKryrKvpMcPAP6VywfiRi6iafgz4Skk7ykJ9-s_xSM47-jEdjZnhBX3GPGiDkMkK9TQVyZRGQ3AEseE3cBRy6wIJuQ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