[cfe-commits] [patch] Fixed for function specifiers
Chris Lattner
clattner at apple.com
Thu May 14 13:48:07 PDT 2009
On May 14, 2009, at 10:41 AM, Douglas Gregor wrote:
>
> inline int f(int), g;
>
> I suggest that we introduce fix-it hints that remove the erroneous
> specifier, e.g., for inline on non-functions, use:
>
> Diag(D.getIdentifierLoc(), diag::err_inline_non_function)
> <<
> CodeModificationHint
> ::CreateRemoval(SourceRange(D.getDeclSpec().getInlineSpecLoc()))
> << SourceRange(D.getDeclSpec().getInlineSpecLoc());
>
Why? I think fixit hints should only be used when we really know what
the user meant. I don't think there is any obvious interpretation
that the user "accidentally typed inline on a variable". If we saw
this in practice, we should reject it, but I don't think there is a
clear indicator of what the user *meant*
-Chris
More information about the cfe-commits
mailing list