https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88501

            Bug ID: 88501
           Summary: Improve suggested alternative to be closer to typo
           Product: gcc
           Version: 8.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jg at jguk dot org
  Target Milestone: ---

"string" spelt as "stting" gives suggestion "stdin" which is 2 characters
different than the expected suggestion to "string".

I imagine it is difficult to get suggestions right, but ideally same length
chars would be considered a closer match.


$ g++ -Wall -o string string.cpp
string.cpp: In function ‘int main()’:
string.cpp:8:5: error: ‘stting’ was not declared in this scope
     stting buf;
     ^~~~~~
string.cpp:8:5: note: suggested alternative: ‘stdin’
     stting buf;
     ^~~~~~
     stdin
string.cpp:10:5: error: ‘buf’ was not declared in this scope
     buf = "hello";
     ^~~




// g++ -Wall -o string string.cpp
#include <string>

using namespace std;

int main()
{
    stting buf;

    buf = "hello";
}

Reply via email to