<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/143688>143688</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Regression in follow-on diagnostic behavior after removing delayed typos
</td>
</tr>
<tr>
<th>Labels</th>
<td>
enhancement,
clang:frontend,
quality-of-implementation
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
AaronBallman
</td>
</tr>
</table>
<pre>
With the removal of delayed typos, Clang now emits some follow-on diagnostics it previously did not. The crux of the issue was that delayed typos would result in a `RecoveryExpr` being made, but without delayed typos, sometimes the invalid statement is dropped entirely now. This leads to follow-on diagnostics, like the following:
```
constexpr int error() { // pre-cxx23-error {{no return statement in constexpr function}}
return invalid;
}
```
The previous AST was:
```
`-FunctionDecl 0x15abc3dacd8 <C:\Users\aballman\OneDrive - Intel Corporation\Desktop\test.cpp:1:1, col:39> col:15 constexpr foo 'int ()' implicit-inline
`-CompoundStmt 0x15abc3dae40 <col:21, col:39>
`-ReturnStmt 0x15abc3dae30 <col:23, col:30>
`-RecoveryExpr 0x15abc3dae10 <col:30> '<dependent type>' contains-errors lvalue
```
and the current AST is now:
```
`-FunctionDecl 0x2958326acd8 <C:\Users\aballman\OneDrive - Intel Corporation\Desktop\test.cpp:1:1, col:39> col:15 invalid constexpr foo 'int ()' implicit-inline
`-CompoundStmt 0x2958326adf8 <col:21, col:39>
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzEVU2P2zYQ_TX0ZSBDIvVhH3TwamOgpwKbFD1T5MhiQ5EqOfLa_76g7M06m6DooUAAGTZAvZn35g2fZYzm5BBbVj2x6nkjFxp9aA8yePckrZ2k2_ReX9s_DY1AI0LAyZ-lBT-ARiuvqIGus4-Md9BZ6U7g_CvgZChC9BPC4K31r5l3oI08OR_JqAiGYA54Nn6J9graaHCetvBlRFBhuaTyqZuJcUF4lRFolPR9R3j1i9UQMC6WwDi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