<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/68527>68527</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang] diagnostic of not-yet-defined consteval function isn't great
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang:diagnostics
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
philnik777
</td>
</tr>
</table>
<pre>
```c++
struct S {
static bool func2() { return func(); }
static consteval bool func() { return true; }
};
```
results in the diagnostic
```
<source>:4:32: error: call to consteval function 'S::func' is not a constant expression
4 | static bool func2() { return func(); }
| ^
<source>:4:32: note: undefined function 'func' cannot be used in a constant expression
<source>:6:25: note: declared here
6 | static consteval bool func() { return true; }
| ^
1 error generated.
```
The note is somewhat confusing IMO, since the `consteval` function is in fact defined. Something like `consteval function that has not yet been defined cannot be used` would be better, and an additional note ```consider moving the definition of `func` above `func2` ``` would be really great.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJykVMFu4zYQ_ZrRZRCDIi0pPujgxGugh6KH9AcociyxS5MBOco2f19QilfJbtACXUOwhAHnzXtvOKNzdmMg6qF5gOZU6ZmnmPrnyfngvnZdVw3RvvbQivUxIB_KI04gjpnTbBifELq3yPqPmFmzMzjE6PEyByNB3oM8lIOYiOcUlvAaBfWA0J0-RTAxZKYX7Tesn6E4zfQRpDuBulG6UX-PnyjPnjO6gDwRWqfHEDM783mOesxxToZAfQF13IM6KgnqiJRSTOXDaO-R4zu6hSm7GBBk9wTqCOq4ku_QZQyRUa-ndWCkv58T5exiuMlH3CN0j_grVuLyKyjQfPkPJSEylfccLF1cIPtBwI250aEwHwjnTLa49y8ifqjVgjrK5n0tS8brRBYnSrRRbj8K_3834BPt9douHClQ0kx292mz_5xoYVjalOOVvk2aC4nLnF0Y8bff_wD5iNkFQ8vdKUNxowit2Hxzy_W6aMP45ukOn-KVeCo43n39mLslcqk46fWWvFLxm8IN44celIrf4uxtCQzETKnQ08GiDqitdQVS-1XSNsYxZGcp4TW-FDbLEJQCy3GMl3J0sboVqIf4QreALJHvOFvtRNr7VxwTaX4ztrK9sgd10BX1dXtou27fKFFNvdQHUytllW4GMzS6bQVpYYdWDlYLYyvXSyFVLcR9va8bJXZ2X186Ze_3tTS1qC3sBV218zvvX667mMbK5TxT3943squ8HsjnZaVJabwOI6jjNuMZpCy7LvUl-26Yxwx74V3mvOGxY79sxTW_Ob1bEsWfEPnulfjue1t-7qPLAWTHqyfVnHw_MT_nsgzkGeR5dDzNw87EK8hzKfz2untO8S8yDPK8qMogz4uwfwIAAP__Rum_Dg">