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

    <tr>
        <th>Summary</th>
        <td>
            [clang] Incorrect type error when using a variable member template of class template
        </td>
    </tr>

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

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

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

<pre>
    Consider the following valid C++14 snippet (https://godbolt.org/z/jYGfzTf7P):
```cpp
template <typename>
struct S {
 template <typename> static const auto x = 1;
};

int r = S<int>::x<int>;
```
Clang trunk gives the following error:
```
<source>:6:5: error: cannot initialize a variable of type 'int' with an lvalue of type 'auto'
    6 | int r = S<int>::x<int>;
      |     ^ ~~~~~~~~~~~~~~
```
Removing either template resolves the error.  Marking `x` as `constexpr` also fixes in this particular case.

This error appears to have started with Clang 9.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyMk0Gv2zYMxz8NfSEayFJiJwcfnLxm2GHAsPayoywzsVpZMiTaL32HffZB9mv3-oABFQxIlkiJP_5JnZK9e6IGDmc4PBV65iHE5jmSJV90of_WXIJPtqeIPBDegnPh2fo7LtrZHi8gzyDP5R6Tt9NEjCCPA_OUQLUgryCv99B3wfEuxDvI6wvI65e_f7u9fL7Vf4I8ZTPRQiW2z0wTiJZpnJxmQlAX_jaR1yOB-giiTRxnw_gJoT6DaPF_LDGxZmvQBJ8Y9cwBHwjqCUtQ2Q_qp9eFaK1njOvhJ1AX6zm_pFpQ7ePN__ltlCDai9P-jhxn_xXvdqH0Lj0UY4jv4PJaXVKYo6HtkQpUewDV_jBHo70PjNZbttrZF0KNi45Wd44w3DBDIsg6xyVrfLY8oPboFu3mnwwyNMg6JwkRK4T6gr-OiuvIPut8-Ij__DTeYf1FY1hWbMtDLpXvskRKwX3Pzgq5Q_xDx6_ZGCrxgEqgTnm5akWPKa5bLgW82QcltB55sAknHdma2emIRifabep9zkfrxainiXRMyAEHvVCugcjUbzna9Drtir5R_UmddEFNWaujKsVR7ouh6Y51RZXuuvrWUXeqjBIkj1IfSUjZm1thGynkQZTZQ9Riv9uLqu86RaLsJOm-gr2gUVu3c24Zc7kXNqWZmlIeymNZON2RS2ujSWlyOCBl7rnYZIcP3XxPsBfOJk7_XcGW3dqdm8fhCX_3JsRIhjepN_bngTzOKWf1Tb2MNHZv1Qg3NE6n9GOnmKNr3rWr5WHudiaMIK85jNfpwxTDFzIM8rpiJZDXV7Klkf8GAAD__8MnWbk">