Skip to content

Regression in follow-on diagnostic behavior after removing delayed typos #143688

Open
@AaronBallman

Description

@AaronBallman

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>

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:frontendLanguage frontend issues, e.g. anything involving "Sema"enhancementImproving things as opposed to bug fixing, e.g. new or missing featurequality-of-implementation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions