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

    <tr>
        <th>Summary</th>
        <td>
            wrong type for `auto&` parameter when deducing a class template partial specialization
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            c++17,
            clang:frontend,
            rejects-valid
      </td>
    </tr>

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

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

<pre>
    Clang rejects this valid code:

```
template<auto &X, int> struct A;
template<auto &X> struct A<X, 0> {};

const int n = 0;
A<n, 0> a;
```

... apparently because it thinks that the expression `X` in `struct A<X, 0>` is an lvalue of type `int`, not an lvalue of type `const int`, when considering partial specializations of `A<n, 0>`.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx8k9Fu4yoQhp9mfDOqRSDGyYUvmuTkGXqLzcThLAELcLvp06_GSVNF6q5kYzzzDwyff5uc3RiIOmh20BwqM5dzTN3ndYw-Olv10V67vTdhxET_01AylrPL-G68szhES6BeQRxAfI1a3K_ltdBl8qYQqL2ZS0SQ-g3kHl0ooP7DXNI8FHwFtfuH_km4X-oFB6HdQXt41N7GIYZceH0MCOrAynuei8Oj2HzXPbd8G-u6RjNNJlEo_oo9DWbOhK7w-cMvxmB4Tki_p0Q5uxgQtHgDLdAt0596XrIZTUD_bvxMGE9YrhOxnplowcoQy8-Sx-Huwo8zBeSgs5RcGHEyqTjjMU80OOPdpykuhsxrgBZPBECLurKdslu1NRV1K92qppXrtqnOnTzJtpHabqzYSNVoUu1K60b1pPu11n3lOimkEqsV32vV1HJNUgxqQyfabE6kYC3oYpyvvX-_1DGNlct5pq7ZbjerypuefF5cJ-UAcgdyt2pBSpB7jrDjQL2eUgyFgn0k7iZ8WfzH0eZQpY63eOnnMcNaeJdL_t60uOKp-0gxjDeKp5gYBbsLpObvMZlkLlQo3XBasvPALA0O3uSMX578C9xqTr47lzJl_hXkEeRxdOU89_UQLyCP3Mr98TKlyP2DPC4wMsjjwuNPAAAA__-v9BO8">