Bug 21235 - [4.0 Regression] Trouble with friend and using namespace
Summary: [4.0 Regression] Trouble with friend and using namespace
Status: RESOLVED DUPLICATE of bug 19403
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.0.0
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-04-26 11:49 UTC by Paolo Carlini
Modified: 2005-07-23 22:49 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work: 3.3.3 3.4.3 4.1.0
Known to fail: 4.0.0
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Paolo Carlini 2005-04-26 11:49:22 UTC
The below doesn't compile with 4.0:

class KopeteAwayDialog { KopeteAwayDialog(); };
namespace Kopete
{
  class Away
  {
    friend class KopeteAwayDialog;
  };
}
using namespace Kopete;
KopeteAwayDialog::KopeteAwayDialog(){}

novell78625.cc:10: error: 'KopeteAwayDialog' has not been declared
novell78625.cc:10: error: ISO C++ forbids declaration of 'KopeteAwayDialog' with
no type

This is a regression from 3.3/3.4. Current mainline is ok, however, most
probably due to these patches from Kriang:

2005-03-14  Kriang Lerdsuwanakij  <lerdsuwa@users.sourceforge.net>

	PR c++/4403
	PR c++/9783, DR433

2005-03-14  Kriang Lerdsuwanakij  <lerdsuwa@users.sourceforge.net>

	Friend class name lookup 5/n
	PR c++/1016
Comment 1 Andrew Pinski 2005-04-26 13:20:48 UTC
Note 3.x did not friend the right class, it should have friended Kopete::KopeteAwayDialog but instead 
friends ::KopeteAwayDialog.  In 4.0.0 we friend the wrong class bug declare the class which is where 
the problem comes from.  In 4.1.0 we do correct thing in that we friend the correct class and now the 
new class is not declared.

Anyways this is a dup of bug 19403.

*** This bug has been marked as a duplicate of 19403 ***