From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 358 invoked by alias); 28 Aug 2013 16:32:39 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 326 invoked by uid 48); 28 Aug 2013 16:32:36 -0000 From: "vova7890 at mail dot ru" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/58263] [feature request] friend class $UndefinedClass Date: Wed, 28 Aug 2013 16:32:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: vova7890 at mail dot ru X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2013-08/txt/msg01482.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58263 --- Comment #2 from vova7890 --- (In reply to Jonathan Wakely from comment #1) > Do we warn in A.cc that B is not defined? It is defined in another header, > but that isn't included by A.cc because it isn't needed. We warn about implicit friend class MyClas2. For example, we wrong writed class name(as in example MyClas2 -> MyClass2, missed the letter "s" in the word Class), try to compile that and see: [vova7890@localhost tmp]$ g++ -O2 main.cpp main.cpp: In member function 'void MyClass2::need(MyClass1*)': main.cpp:10:9: error: 'void MyClass1::help()' is private void help(); ^ main.cpp:18:16: error: within this context cl->help(); // error: is private!! But, we don`t understand why it`s private, because we think that we correctly writed class name(friend class MyClass2), and do not see where is the bug exactly. But, if compiler say as, about implicit friend class MyClas2, like this: [vova7890@localhost tmp]$ g++ -O2 main.cpp main.cpp:8:12: warning: implicit declaration of friend 'MyClas2' friend class MyClas2; ^ main.cpp: In member function 'void MyClass2::need(MyClass1*)': main.cpp:10:9: error: 'void MyClass1::help()' is private void help(); ^ main.cpp:18:16: error: within this context cl->help(); // error: is private!! we see where is exactly issue, and just correct that stupid typo.