https://bugs.llvm.org/show_bug.cgi?id=40233

            Bug ID: 40233
           Summary: friend definition makes function visible when it
                    should not
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangb...@nondot.org
          Reporter: rhain...@binghamton.edu
                CC: blitzrak...@gmail.com, dgre...@apple.com,
                    erik.pilking...@gmail.com, llvm-bugs@lists.llvm.org,
                    richard-l...@metafoo.co.uk

Based on this stackoverflow question:
https://stackoverflow.com/q/54055638/1013719

gcc correctly rejects the following, while clang accepts:

```
class Cls {
    friend void func(int) { }
    friend void ::func(int);
};
```

with:

```
error: ‘void func(int)’ has not been declared within ‘::’
     friend void ::func(int);
                 ^~
note: only here as a ‘friend’
     friend void func(int) { }
                 ^~~~
```

The friend definition should not make `func` visible by
http://eel.is/c++draft/namespace.memdef#3.sentence-2

> The friend declaration does not by itself make the name visible to 
> unqualified lookup or qualified lookup.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to