Skip to content

Typo correction/Recovery Expr causes bad follow-up diagnostic: #139314

Open
@erichkeane

Description

@erichkeane

See:
https://godbolt.org/z/b99E59WxT

template<typename T>
struct S {
    template<typename U = T>
    void getsTypoCorrection(){}

    void baz() {
        getsTypoCorrectoin();
    }
};

Diagnoses as:

<source>:10:9: error: use of undeclared identifier 'getsTypoCorrectoin'; did you mean 'getsTypoCorrection'?
   10 |         getsTypoCorrectoin();
      |         ^~~~~~~~~~~~~~~~~~
      |         getsTypoCorrection
<source>:7:10: note: 'getsTypoCorrection' declared here
    7 |     void getsTypoCorrection(){}
      |          ^
<source>:10:9: error: cannot refer to member 'getsTypoCorrection' in 'S<T>' with '->'
   10 |         getsTypoCorrectoin();
      |         ^
<source>:7:10: note: member 'getsTypoCorrection' declared here
    7 |     void getsTypoCorrection(){}

The first diagnostic is correct, but the 2nd is super weird/awkward. I'm guessing we're not doing a good job checking to make sure the this isn't implicit? Or not setting it right?

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzer

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions