This is an archive of the discontinued LLVM Phabricator instance.

Enhance diagnostics for friend function from global namespace
Needs ReviewPublic

Authored by sepavloff on Aug 18 2016, 11:41 AM.

Details

Summary

A user may reference a function from global namespace in friend
declaration, which returns enum or class, as in example:

enum E { A, B };
E func();
namespace N {
    class C {
        friend E ::func();
    };
}

This is wrong as the identifier following '::' must be considered
as a part of nested-name-specifier.

This change implements additional note in such case with a hint to put
parenthesis around the function qualified name.

It fixes PR28422 (https://llvm.org/bugs/show_bug.cgi?id=28422).

Diff Detail

Event Timeline

sepavloff updated this revision to Diff 68583.Aug 18 2016, 11:41 AM
sepavloff retitled this revision from to Resolve ambiguity in a declaration if global nested name specifier is used.
sepavloff updated this object.
sepavloff added reviewers: rsmith, doug.gregor.
sepavloff added a subscriber: cfe-commits.
sepavloff updated this revision to Diff 70503.Sep 6 2016, 11:58 PM

Reworked patch

sepavloff retitled this revision from Resolve ambiguity in a declaration if global nested name specifier is used to Enhance diagnostics for friend function from global namespace.Sep 7 2016, 12:01 AM
sepavloff updated this object.
sepavloff updated this object.Sep 15 2016, 12:14 AM