[Bug c++/88501] Improve suggested alternative to be closer to typo

jg at jguk dot org gcc-bugzilla@gcc.gnu.org
Fri Dec 14 23:49:00 GMT 2018


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

--- Comment #3 from Jonny Grant <jg at jguk dot org> ---
(In reply to David Malcolm from comment #2)
> Confirmed.  "string" vs "stting" has edit distance of 1, closer than
> "stdin".  I think the issue here is that it's not considering names that
> would be found via using-directives.  I have a work-in-progress patch to do
> so, which makes it successfully suggest "string" for this case.

Great!

I wonder, for typos if a simple byte compare would be enough? Vary each char by
1 letter, or length. This starts to get complicated I know..

A few that still work
"st4ing"
"st$ing"
"st%ing"

A few that do not work (I did think gcc could output UTF-8) but it would seem
not - I'll file a separate ticket

"st!ing"

"st£ing"

string.cpp:8:7: error: stray ‘\302’ in program
     st��ing buf;
       ^
string.cpp:8:8: error: stray ‘\243’ in program
     st��ing buf;


More information about the Gcc-bugs mailing list