This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: c++/7522: access by friend function's default argument


Hi,

On Thu, Oct 31, 2002 at 05:24:55PM -0000, bangerth@dealii.org wrote:
> Synopsis: access by friend function's default argument
> 
> State-Changed-From-To: feedback->analyzed
> State-Changed-By: bangerth
> State-Changed-When: Thu Oct 31 09:24:55 2002
> State-Changed-Why:
>     One way or other, the example Christoph gave shows a bug,
>     since treatment is not consistent. So I reset the state
>     to "analyzed".
>     
>     And no, I don't know what is right and wrong here, sorry.

A post by John Spicer to comp.std.c++ (Thread: "Req Clarification:
private type used in parameter list of friend function") pointed me to
11.0.5 in the standard. There is an example that settles the question,
I think:

  class A {
    typedef int I; // private member
    I f();
    friend I g(I);
    static I x;
  }; 

  A::I A::f() { return 0; } 
  A::I g(A::I p = A::x); 

gcc 3.2.1 rejects the default argument in the last line, but according
to the standard the example is well formed.

Regards

Christoph

> http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7522



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]