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

Elie Morisse syniurge at gmail.com
Thu Aug 30 12:28:15 UTC 2018


On Thursday, 30 August 2018 at 12:18:10 UTC, Elie Morisse wrote:
> On Monday, 11 June 2018 at 15:41:57 UTC, Steven Schveighoffer 
> wrote:
>> I filed a bug about a similar thing (calling private functions 
>> instead of using private variables), but it seemed to be 
>> agreed upon that this is expected behavior:
>>
>> https://issues.dlang.org/show_bug.cgi?id=15897
>>
>> You may find some more insight from reading that discussion. I 
>> don't agree with the conclusion, as it is very surprising 
>> behavior to me.
>>
>> -Steve
>
> Not the same, bauss' case is a template method that wouldn't 
> get the depreciation warning if it wasn't templated. Template 
> instances not always having the same access privileges as their 
> template declaration's is definitely a bug.

Or actually since I didn't test the code it's more likely just 
due to T being Bar, in which case there's no reason to make the 
cast to Foo mandatory since Foo's field get accessed from Foo's 
method.


More information about the Digitalmars-d mailing list