[cfe-dev] PR5478 Patch - unexpected function pointer in argument diagnostic improvement

John McCall rjmccall at apple.com
Tue Mar 30 15:13:11 PDT 2010


On Mar 30, 2010, at 2:56 PM, Samuel Harrington wrote:
>> +    S.Diag(FromExpr->getExprLoc(), diag::note_ovl_candidate_bad_conv_funcptr)
>> +      << CodeModificationHint::CreateInsertion(S.PP.getLocForEndOfToken(FromExpr->getLocEnd()), "()");
>> 
>> This is going to emit a second note, after we've already said "bad conversion". That could get noisy if there are several overload candidates with the same problem. How about creating a variant of note_ovl_candidate_bad_conv that you can use instead of note_ovl_candidate_bad_conv, which says something about the missing '()' in the same note? We do this for, e.g., arguments of incomplete type and it's rather nice (see note_ovl_candidate_bad_conv_incomplete).
> 
> Ok, done. Please note that the diagnostic for this case now points to
> the call instead of the declaration of the function, so the code
> modification hint can be displayed. For this case, I think this is
> more understandable.

Please don't do this.  Consistency is important, and so is knowing what candidate the note is referring to.  The code modification hint isn't worth losing that (not that you should remove the hint;  it just won't get displayed by the console client).

John.



More information about the cfe-dev mailing list