friend function definition

Jonathan Wakely jwakely.gcc@gmail.com
Tue Mar 27 17:12:00 GMT 2018


On 27 March 2018 at 17:49, Hans-Christian Stadler
<hans-christian.stadler@psi.ch> wrote:
> Thanks a lot for clearing that up.
>
> Now I just don't understand the text in the N4700 early version of the C++17
> standard (under class.friend):
>
> A function can be defined in a friend declaration of a class if and only if
> the class is a non-local class (12.4),
> the function name is unqualified, and the function has namespace scope. [
> Example:
> class M {
> friend void f() { }
>  // definition of global f, a friend of M,
>  // not the definition of a member function
> };
> — end example ]
>
> Anyway, it's probably to wierd a case to spend much time on.

That's unrelated to your example, and is a better question for
stackoverflow, since it's nothing to do with GCC.



More information about the Gcc-help mailing list