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

    <tr>
        <th>Summary</th>
        <td>
            [Clang] Clang fails to deduce the type of variable member templates
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang:frontend,
            diverges-from:gcc,
            diverges-from:msvc
      </td>
    </tr>

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

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

<pre>
    The following code has been rejected since Clang 9, with a suspicious error:

```cpp

template <class T>
struct S {
  template <class U>
 static const auto var = T();

  template <class U>
  static const auto foo = var<T>;
};

const int p = S<int>::var<int> + S<int>::foo<int>;

```

```
invalid operands to binary expression ('const auto' and 'const auto')
   10 | const int p = S<int>::var<int> + S<int>::foo<int>;
      |               ~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~
```

https://compiler-explorer.com/z/jc1To6c38

The code is accepted by GCC (since 5.1), MSVC but also rejected by EDG.

It's unclear to me if this is conforming per the standard, but from my gut feeling this should be valid
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJy0VMGO4zYM_Rr6Qkwgy7GdHHxInMmih55m2rss07YWsmRIcnazh357ITnodCdtbxUEJKaoR_HxkcJ7NRqiBsozlJdMrGGyrvlxN4znddbZ_t68T4SD1dp-U2ZEaXvCSXjsiAw6-koyUI9eGUnYamFGPAJv8ZsKEwr0q1-UVHb1SM5ZB8UJWNoV27Zcls0SaF60CIRQtFIL7_EdildgJx_cKgO-IdRnYCfEZ8_fNk_0QQQlUVrjA4o1WLwJh1Bc8B34AfgRivMW7b9Q_gFmsDbB3ISDok0P25Dqy1-Qm7syAZfk-wZFq0xIvicoTtvdzYLAz08Og7V_s5w_EfX8qcxNaNWjXcgJ03sMFjtlhLsjfV8cea-swZR4_ZEL8BqF6fGzMbITk8ecIdQt_g_pYFoR_Of1x6eFUL4-GZ-5mEJYfIzFr8Cv0s6L0uRe6PuirSO3k3YGfv0B_PpV5u-2ksVhuxglnYSsPAopaYkS7u74pW0jXZuYy10eKeEt_vr2e4vdGlBobz80393x9fJlt0H-EoDXHlcjNQkXKzETqgHDpHwMI60ZrJtjCy3kMEwUVWZ64foYIqIPzs4433GM_4l09E3X_WRX3WNHmOqd9U3RH4ujyKjJ631xLPa8rrKpYfKQH8SBqvLQEZdMVlXJBpIl9eVwFCxTDWe8ZHtW5SzP82onDxXVrMp53eWHqiTYM5qF0jutb_POujFT3q_U5MW-5FWmRUfap2HBuYzNHsvsrAlkeuAceAuc9-pGbiT_EhOC4jRK-a9ns7-lw_KSuSYGfenW0cOeaeWD_3hGUEGnKZVGDJSXx6wZhNJJ9z31q6TEa7gvhHaIvapEpwlnmrvI-aPhfbY63fwsnlGFae0eiolRHz8vi7Ox3MCviQkP_Pog49bwPwMAAP__XPafOA">