<div class="gmail_quote">On Thu, Aug 18, 2011 at 2:30 PM, Jordy Rose <span dir="ltr"><<a href="mailto:jediknil@belkadan.com">jediknil@belkadan.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Haven't tested it, but it seems like this would also be bad for const/non-const mismatches:<br>
<br>
struct A { int typo() const; };<br>
int A::typo_() { return 3; }<br></blockquote><div><br>In this case the typo-corrected function would be close but not exact. The correction note points to the definition of the correction:<br><br> tmp.cpp:2:8: error: out-of-line definition of 'typo_' does not match any declaration in 'A'; did you<br>
      mean 'typo'<br>int A::typo_() { return 3; }<br>       ^~~~~<br>       typo<br>tmp.cpp:1:16: note: 'typo' declared here<br>struct A { int typo() const; };<br>               ^<br><br>However the fixit, if applied, will get the function closer but won't fix the code entirely, and the "fixed" code then yields:<br>
<br>tmp.cpp:2:8: error: out-of-line definition of 'typo' does not match any declaration in 'A'<br>int A::typo() { return 3; }<br>       ^~~~<br>tmp.cpp:1:16: note: member declaration nearly matches<br>struct A { int typo() const; };<br>
               ^<br><br>This is actually a limitation I'm currently aware of, where DiagnoseInvalidRedeclaration will correct typos but cannot correct missing function qualifiers like "const", and that when both are present the fixit doesn't completely fix the code. I feel that, while imperfect, having the fixit with this limitation is more beneficial than doing the typo correction but not providing any fixit--so that invalid redeclarations that only suffer from a mistyped name can be fixed. If the name required typo correction *and* there was some other mismatch then there might be something wonkier than a simple typo. If the consensus is that the fixit should only be given when it completely fixes any issue with the redeclaration I can try to figure out and add the hoops necessary to only suggest the fixit if there is a function declaration that exactly matches the typo-corrected redeclaration.<br>
<br>Cheers,<br>Kaelyn<br></div></div>