Hello there,

Give the following C++ code

class A
{
private:
        void f();
};

class B
{
private:
        friend void A :: f();
};

then g++ 3.4.2 and g++ 3.4 snapshot 20050128 say

[EMAIL PROTECTED] Alphasrc]$ ~/gnu/20050128/results/bin/g++ -c friend2.cc
friend2.cc:5: error: `void A::f()' is private
friend2.cc:11: error: within this context

I checked a couple of other C++ compilers, and they were happy with
the code.

I checked Stroustrup 3, section 11.5, page 279 in my copy. He has similar
code, and he appears to claim that the code should be ok.

Would I be correct in thinking that the definition of the language has
recently changed in this area ?

-- 
           Summary: error for legal friend statement ?
           Product: gcc
           Version: 3.4.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dcb314 at hotmail dot com
                CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: linux-i686-pc-gnu


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

Reply via email to