Topic: friend declarations


Author: jpotter@falcon.lhup.edu (John Potter)
Date: 1997/08/26
Raw View
I think the rules may have changed.  All of my compilers accept the
following, but it may be incorrect.  I haven't had any success reading
CD2; so, some help there would also be appreciated.

struct A {
 friend A f (A const&);
 };
// A f (A const&);
A (*p)(A const&) = f;
void g () {
 A a;
 f(a);
 }

Are one or both uses of f now invalid without the commented out
declaration?

John
---
[ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
[ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
[ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]