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

    <tr>
        <th>Summary</th>
        <td>
            [clang] std::convertible_to incorrect with templated class
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

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

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

<pre>
    Min repro:

```
#include <span>
#include <type_traits>

template <size_t N>
struct TemplatedFoo {
    static constexpr const int Ints[] = { 1, 2 };
};

// std::span<const int> bla = TemplatedFoo<0>::Ints;
// This static assertion fails, but if we uncomment the above line, then it works.
static_assert(requires {
    {TemplatedFoo<0>::Ints} -> std::convertible_to<std::span<const int>>;
});

struct Foo {
 static constexpr const int Ints[] = { 1, 2 };
};

// This static assertion always works fine
static_assert(requires {
    {Foo::Ints} -> std::convertible_to<std::span<const int>>;
});
```

godbolt link: https://godbolt.org/z/scsjEf4Y6

As the comments in this code snippet say, the requires clause works fine when dealing with non-templated types or when a global variable is defined such that conversion to a span must happen. In gcc, the static assertions always pass regardless of whether that global variable is defined.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy8VE2PozgQ_TXmUuoITAjJgUN3pyPNYfeyc9lTy5gCPGNs1lUk2_PrVwaS_tBMS3vYlZDjyFXPr96rsiIynUOsRPEgimOiJu59qP5Qw4M_Y1L75qX6zTgIOAYv8nuRHkV6XXfp-i1_ZW6ctlODIPJHGpUT-dPPjvhlxGcOyjC9Rswr4zBaxQuA-YHPDL_fQojDpBm-rjHNyXsQ5cNyCABArNho0N4R499jWHZgHMMXx7RUCCI_xjTIhHwECaI8inwFebdfiZ-EPAFxE2vP75eqHm_AIn-C2qoZ9C0xkT-mkficNF9-w10Qv_aGroQVEQY23kGrjKXIq54YTAsXhMlpPwzoGLhHULU_I1jjMEZxjw4Mw8WH77S5qhQxnxdMIfcB_5pMQHovlSgfPqdbHuEuFnerXHt3jixri88cEz7TZP7eiCoPH3RdvXxv4X_n38_VVvaiXmhRD9qo6b9TcBbuf1Dsw5jNa-eb2luOrfBd5PfQM48U0eeC19OND52Qpx9CnkjTt6d2--fuLcg9zU21NhiBccBRKe0bBHJmHJGB1Mvaa3BTQls1Eb5RDi6xFRtU1rgOLoZ7cN7dXee5gTjzBD4sgQo662tl4ayCUbVFMAQNRqQGaNI9cK8YFgUpesUeFETdYJiIoVfjiG4DXxx0Wl_5fXSYrhaPiggCdio0FonAt5EH9xiWi37NZpM0Vd4c8oNKsMp2-225K7K0TPpK1oXM2rQosqxFmeZNUdQqU9uyzWSm0zwxlUxlnhZSZttsL8tNvZXp4VAeikaW2wz3YpvioIzdWHseoleJIZqw2sn9rkisqtHS_C5L6fAC86GQMj7ToYo5d_XUkdim1hDTKwobtvODrq1yXZyZX_QkGKd9CKh5sezVLm0VUTIFW31oLMP9VG-0H4Q8xQvXn7sx-G-oWcjTTJOEPM1l_BMAAP__cp_8TA">