https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61490

            Bug ID: 61490
           Summary: accepts-invalid: qualified-name in friend function
                    definition
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: filip.roseen at gmail dot com

Created attachment 32929
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=32929&action=edit
testcase.cpp

namespace N { void f (); }

struct A {
  friend void N::f () { } // violates [class.friend]p6
};

int main () { }

-----------------------------------------

`gcc` inaccurately accepts the above snippet, even though we are
referring to a qualified-name in our friend definition, something
which is ill-formed according to [class.friend]p6:

 > A function can be defined in a friend declaration of a class if and
 > only if the class is a non-local class (9.8), the function name is
 > unqualified, and the function has namespace scope.

Reply via email to