This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
C++ Accessibility bugs in egcs
- To: egcs-bugs at cygnus dot com
- Subject: C++ Accessibility bugs in egcs
- From: ak at muc dot de
- Date: Sun, 15 Mar 1998 03:45:55 +0100
[Resending because I can't find my original mail in the egcs-bugs archives.
My apologies if this will turn up twice.]
Version:
gcc version egcs-2.91.13 980308 (gcc-2.8.0 release)
This example compiles incorrectly in g++. Bla::Init is a private member,
so it should be not accessible in the anonymous namespace. Both KAI C++
and Tendra C++ correctly reject this. The example is lifted [with
small changes and different Names] from Stroustrup "The C++ Programming
Language" 3rd ed. page 640.
#include <iostream.h>
class Bla {
class Init;
};
class Bla::Init {
static int cnt;
public:
Init();
~Init();
};
namespace {
Bla::Init init;
}
int Bla::Init::cnt = 0;
Bla::Init::Init()
{
if (++cnt == 0) cout << "Init" << endl;
}
Bla::Init::~Init()
{
if (--cnt == 0) cout << "Ende" << endl;
}
-Andi