Hi,

Attached is a patch to fix an assertion that occurs when printing diagnostic
warnings for non-class friend usage.

Example:
This case prints fine:
struct { friend int; } a;
  warning: non-class friend type 'int' is a C++11 extension [-Wc++11-extensions]
  friend int;
  ^~~~~~~~~~

This case causes an assertion:
struct {int friend; } a;
  warning: non-class friend type 'int' is a C++11 extension [-Wc++11-extensions]
...
Assertion `StartColNo <= EndColNo && "Invalid range!"' failed.

The problem is that when printing the diagnostic the possibility that the
friend specifier may appear after the type specifier is not considered.  The
fix is to check whether the friend specifier appears after the type and adjust
the highlight range accordingly.


Can someone review and, if everything is OK, commit?

Thanks!
Josh

Attachment: friend-diagnostic-fix.diff
Description: friend-diagnostic-fix.diff

_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to