Is it a bug that a parent class that access its own private members from derived classes gets deprecation warning?

bauss jj_1337 at live.dk
Sat Apr 7 20:14:49 UTC 2018


jesus that became a long title.

Anyway as the title says, is it a bug that a parent class that 
access its own private members from derived classes gets 
deprecation warning?

Scenario narrowed down:

// module foo;
class Foo
{
     private:
     bool _baz;

     public:
     final void foos(T : Foo)(string key, T[] values)
     {
       if (values && values.length)
       {
         foreach (child; values)
         {
           child._isChild = true;
         }
       }
     }
}

// module bar;
class Bar : Foo
{
}

The above in my case will give a deprecation warning that "_baz" 
isn't visible from "Bar".

Seems like a bug to me since I'm accessing "_baz" from "Foo" 
itself and not from "Bar" or is it by design that you can't do 
such thing.

I'm thinking it's because of my templated function perhaps?

I haven't decoupled it out of my project to make a separate 
compilation, I just want to clarify it's not a design thing 
first, because if it's by design then I don't want to spend more 
time on it than necessary.

If it's not by design then I'll narrow it down even more, to see 
if it's reproducable as above.

(I did not test the narrowed down version.)


More information about the Digitalmars-d mailing list