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

    <tr>
        <th>Summary</th>
        <td>
            Clang requires `template` keyword in places it should not (P0634, P1787)
        </td>
    </tr>

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

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

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

<pre>
    Testcase:
```c++
template<typename T> void F() {
  T::X<int> f();
}

template<typename T> class C {
  T::X<int> g();
};

template<typename T>
T::X<int> h();
```
Under P1787 (DR against C++20), per [temp.names]/3, the `template` keyword is not required before `X` in `g` and `h`, following the same rules that P0634 established for type-only contexts. But Clang (and GCC) seems to not implement this, and still requires `template` in `g` and `h`.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx8U02PozoQ_DXNpZUIbD7CgUNCXt519DRPmqsDHfCusbNuk9nsr1-ZZDLS7OxIlmjcRVW52ihmPViiBoodFPtEzWF0vvl1HZxxuk-Orr82z8ShU0wgt5DuId1Cmd5WB2IX17IbaDobFQhkG65nsmoifAb5D16c7vEAYgOiRqjucIzNLcjtC8hW2xCRpxsI5B0D1f5efK3QGcWM7dfkwyfkj_pL_lv3T8bxI-NbLrfX_21PHp-yalMhiM3-P1SD0pYDtrfcRBq_Fi2eySMUu6i_jqoMxR7EQcZeGAmhTB_eyhS_0_XV-R41o3UBPf2Ytacej3RyfkG_RJi2sRxiqWwf6zF6Ey2enDHuVdthYed4Tj8bYgyjCviUljJH4qCORvNIPZ6cx5jIyllzxc7ZQD8Dr3E3B2yNskM8X9T4t23jkJloYgxusaens6GJbMAwao7yEclBG_NmnT-e8HPr66RvZF_LWiXUZFW2kanIZZ2Mjczzss67Kq-6LOuFknmdl8VJ1ZsTVWl_THQjUpGnZSazTSaLel1TKfO-k2mepVR3CvKUJqXN2pjLtHZ-SDTzTE1d5HmVGHUkw8tfIkT3Pj0Boo07MQOQ25OP0dj-0fD0jbrAq4syetkt9olvosTqOA8MeWo0B34XDToYam6Z_i2cx_gtno3qiFEH5NHNpl8CB7FZRhijXm4fiDqZvWnGEM4cb7E4gDgMOozzcd25CcQhGrg_VmfvomsQhyUCBnG4pXBpxO8AAAD__271PPM">