The following two invalid code snippets are accepted by the C++ frontend
(the members of A cannot be defined in B):

===============================================
struct A { void foo(); };

struct B { friend void A::foo() {} };
===============================================

===============================================
struct A { A(); };

struct B { friend A::A() {} };
===============================================

Since the second code snippet was rejected in GCC 3.2.x and 3.3.x
(although with a bogus error message) this is regression.


-- 
           Summary: [3.4/4.0/4.1/4.2 regression] Member definition in wrong
                    scope accepted
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid, monitored
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: reichelt at gcc dot gnu dot org


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


Reply via email to