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

    <tr>
        <th>Summary</th>
        <td>
            Inconsistent behavior of builtin vector operators with implicit conversions
        </td>
    </tr>

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

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

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

<pre>
    If you have a type wrapping a vector type that provides implicit conversions, like:
```cpp
typedef int __attribute__((ext_vector_type(4))) vec4i;
struct vec4i_wrapper {
    vec4i x;

 vec4i_wrapper(const vec4i& val): x(val) {}
    operator vec4i() const { return x; }
};
```
then the behavior of built-in vector operators is inconsistent. Some operators find the implicit conversion, others do not.

```cpp
vec4i_wrapper test_operators_homogenous(vec4i_wrapper a, vec4i_wrapper b) {
  // The operator overload isn't defined, so this is implicitly:
  // a = vec4i_wrapper(vec4i(a) + vec4i(b))
  // Note: This finds an overload
  a = a + b;
  // This does not!
  a = a & b; // expected-error{{invalid operands to binary expression}}
}
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxsVEGPszgM_TXhYk2VBtrCgcN0q0rfZS_73VEAt3g3TVBimOn--k8BykzVkZBaHPs9-z0THQJdLWIpdkehVO_81eD_7tYLpcTulOiBO-fLr3hSu_Ze_rrA3Q3Q6RFBA997hA-v-57sFTSM2LDzc5g7zdB7N1KLAejWG2qIoXF2RB_I2SDUX2DoPxTpu5AnId_FXs5P0_dzJCK1eAGyDFWlmT3VA2NVCZULleMnVzNnFTOFyjOhivmJzWQk0uOMFNgPDc_BamoZPYjDcgoA8xF8rhXLyVOFUHnjbFhwhNrDqE3kS9_hU6h8fptwD6cvaNej11GZpSyPSTOQOBzBIw_eTtSw1sU_aysPYRZVOrTAHUKNnR7JeXAXqAcy_Eb2YcKDMwAFIBvZKDBa3sA_7obfzi9k2wnuB5OiR4479AFaB9bx5rs4r4Y968sYuFqJqs7d3BWtG0KU6ilTR6LnUP1QcpFRqLNQZ_jdffUObkRvnG6BghXqwNDihSy2ES044I7m8ZfBzH3dtRVPg0hPLy4_jNJTE-q4OlcvC_YM8rfjuMbwOxJGPQNou3b3SJ6p9IRXr-Z-m4yiyhiizkJtX8v2U9kjHz97bBjbN_Te-WnnjmRHbaidFYptsIOarPb3mO4xTKYeTk9r9uxl0pZpW6SFTrDc7vOdzAuZb5OurOs0zbYoi8tlh7VMD_m20FmNUuo8L3Y6oVJJlcqd2st8m8vtJi8u7batMykLmaVKiUziTZPZGDPeNs5fEwphwHKviqxIjK7RhOlC2p0SX8akt3q4BpFJQ4HDVxkTGyx_fdvq12_hp0_hg7j78S5KBm_KjrkPcUMmfa_E3VBvGncT6hyZl5-33rt_sWGhzlP3QajzNMCfAAAA__9CDavr">