Type access control -- now too strict

Chip Salzenberg chip@valinux.com
Sat Apr 1 00:00:00 GMT 2000


Apparently it's now impossible to define static data of private type
if that private type has a constructor.  Consider priv.cc:

--------------------------------
class A {
  private:
    class B { B(int) {} };
    static B b;
};
A::B A::b(1);
--------------------------------

Here's the output of today's g++ snapshot:

priv.cc:3: `class A::B' is private
priv.cc:6: within this context
priv.cc: In function `void __static_initialization_and_destruction_0
priv.cc: (int, int)':
priv.cc:3: `A::B::B (int)' is private
priv.cc:6: within this context

Strangely, if I use the default constructor, I get no complaints.
-- 
Chip Salzenberg              - a.k.a. -              <chip@valinux.com>
"I wanted to play hopscotch with the impenetrable mystery of existence,
    but he stepped in a wormhole and had to go in early."  // MST3K


More information about the Libstdc++ mailing list