<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/84810>84810</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[consteval] Inside consteval member function: use of 'this' pointer is only allowed within the evaluation of a call to a 'constexpr' member function
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
CarloWood
</td>
</tr>
</table>
<pre>
The following snippet:
```
template<int Id>
struct SymbolRef { };
struct Symbol {
int const id_;
consteval Symbol() : id_(1) { }
template<int Id>
consteval operator SymbolRef<Id>() const
{
return SymbolRef<this->id_>{};
}
}
```
results in the compile error:
```
<source>:12:22: error: non-type template argument is not a constant expression
12 | return SymbolRef<this->id_>{};
| ^~~~~~~~~
<source>:12:22: note: use of 'this' pointer is only allowed within the evaluation of a call to a 'constexpr' member function
1 error generated.
```
g++ compiles this without errors.
I think the code is well-formed?
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy8VE-P-yYQ_TTjyyiRAWdtH3zIX2mvbaUeK2xPbFoMFuDN5tLPXmFns8lW3Uq_ww9FJIR5M_PeA6T3qjNEFWx2sDkkcgq9ddVeOm1_t7ZNatteq996wrPV2l6U6dAbNY4UQGwhPUD6Mb-kt8-8DDSMWgYCsVcm4GsL4rjs-OCmJuCv16G2-hc6I-Q7hPwAYveY7yksxix_I8Z0jTU-oGr_-ALCZYfepL4hgRfASwSxncN5weblreQT9L9bfkxrR3IyWPdJAMR-iV1KzaEfuIe-ER2FyZknYOiVX4E4zlSOMfpBiIcW7z-eVV5mR37SwaMyGHrCxg6j0oTknHXfuwRi7-3kGorFxZZxEFsepzsYjTWrcB3pLg9K100DmYDKo7EB5UJZmoD0PjryXllzZ804Qr7HH-S_AP81YHP8-zb-j4ix0dEtTp7QnhF4HmsCz3G0ygRykYY1-ooyHnBq8aJCf5MyOj7JoKyJWImN1BqDRRnzLGfifXQx2UBDTQ7Pk2nCnT5bZMSOTDw01K6_cbEDvgO--7DPY-xzbsZOYUnk14-A1xhh_rp53lIkciGtV2frBmpBnJK2Em0pSplQxXKWsoKVKU_6qkhfhMgzKjZZIVha5iXPG7ZpNzJLWV3Xiap4yrNUMMYKwTK-rtsybWtKy3PTNmchIUtpkEqvtX4b1tZ1ifJ-oqrICpYmWtak_fyocG7ogvMmcB7fGFdFzKqeOg9ZqpUP_jNLUEHPr9H9xsHmgK_Gq5YebuFXuX-6wcnkdNWHMPp4w_gJ-KlToZ_qdWMH4KdI6Pa1Gp39k5oA_DTL4IGfZpn-CQAA___FbqsU">