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

    <tr>
        <th>Summary</th>
        <td>
            [C++2b] `if consteval` doesn't work well in template instantiations
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            c++2b,
            consteval
      </td>
    </tr>

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

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

<pre>
    For,

```
// a.cpp
template<typename T>
auto a() {
        if consteval {
                typename T::type x;
        }
}

void b() {
        a<int>();
}
```

compile it with

```
clang++ -std=c++2b a.cpp -fsyntax-only
```

We will see

```
a.cpp:4:12: error: type 'int' cannot be used prior to '::' because it has no members
                typename T::type x;
 ^
a.cpp:9:2: note: in instantiation of function template specialization 'a<int>' requested here
        a<int>();
        ^
1 error generated.
```

But this shouldn't be true.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyEVMGS2jAM_RrlooExdkLIIYcAyxd0pr06jiBuHTtrO8vSr-8kYVnYaSnDOLKteZLekyxD0CdLVEK2hWyfyCG2zpe7dpD2Vf8YiqR2zaU8OA98B2wPrLqua3b9z1t-AH5AuVR9P59E6nojI4HYxUtPVnaE30C8zLdyiA4l8A3wAiHffkAX-ojK2RDpTZqHC2DFPU4Fohr3-A7izinfX-2bMa1vTjdY_yWcBLHTNo55TZefYDeAL4VOq3Jdrw2hjnjWsX1CjDLSnoBvgW9xEWIDYq_mLa9nunBxDBcb5fvCWXN5EvQ74Vkbg4HoScBZAlGlIKoVB1Ehee_8aEx8Ac_HgnmOSlrrItaEQ6AGe6-dx-hGj5nf0akmJYcwVdrKgNZhR11NPszR8MvvPxIhZC-PaRYgqilL68ZeqVBb1DZEaaOWUTuL7ojHwarJ_mgqDD0pLY3-PfsAz--VzNHT60AhUoMteXrM9Z-afzjcklzN3OGJLHkZqVk-kWc7RIytDhhaN5jGAs8ncqMfaJk0pWgKUciEytU6z1K24WyTtKXMKK_laqWEklTUBYk6q1PV5Bu2LtaMJ7rkjAvGmWD5irHNUinW8LRJVUFHOhYppIw6qc3SmLdu6fwp0SEMVK5ZxtLEyJpMmMab81vnAefjPHN-m7XxJNsnvhxRFvVwCpAyo0MMn7hRRzO9FLsbTrZHWLP7oYU1w8ZRmOs_O_8Lz2TMqOtNvQeBQzJ4U7Yx9mHqufEhOenYDvVSuQ74YYx__Sx6736SisAPU5EB-GGq808AAAD___fZW8A">