[Bug c++/29041] New: failure to check for visible declaration of friend function to local class

amylaar at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Tue Sep 12 20:28:00 GMT 2006


The following code should not compile:

int f(int);
void g()
{
  class C {
    friend int f(int);
  };
}

The C++ standard clause 11.4 ; 9 states that friend declarations in local
classes have different rules to friend declarations in regular classes. Friend
functions must be previously declared in the innermost enclosing non-class
scope.


-- 
           Summary: failure to check for visible declaration of friend
                    function to local class
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: amylaar at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29041



More information about the Gcc-bugs mailing list