[Bug c++/58263] [feature request] friend class $UndefinedClass

vova7890 at mail dot ru gcc-bugzilla@gcc.gnu.org
Wed Aug 28 18:01:00 GMT 2013


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

--- Comment #5 from vova7890 <vova7890 at mail dot ru> ---
(In reply to Jonathan Wakely from comment #3)
> But that will warn about valid code, where you didn't spell the name wrong.

Yes, but it can be not in one file, as in example. If it in one file, and
friend class is below the main class, can avoid warning by this:

class MyClass2;

class MyClass1
{
   friend class MyClass2; // trivial stupid human issue with MyClas2 ->
MyClass2
private:
   void help();
};

class MyClass2
{
public:
   void need(MyClass1 *cl) {
      cl->help();   // error: is private!!
   }
};

Also, maybe can use it on paranoid level warnings, for example.



More information about the Gcc-bugs mailing list