private with alias this

evilrat evilrat666 at gmail.com
Mon Dec 24 23:21:11 PST 2012


On Tuesday, 25 December 2012 at 05:28:54 UTC, Zhenya wrote:
> On Tuesday, 25 December 2012 at 02:43:52 UTC, r_m_r wrote:
>> On 12/25/2012 07:42 AM, r_m_r wrote:
>>> assert(!__traits(compiles, b._bar));
>>
>> sorry, i made a typo: it should be bar_ instead of _bar.
>>
>> Interestingly, the below assertion fails at run time:
>>
>> assert(!__traits(compiles, b.bar_));
>>
>>
>> but this won't compile (as expected):
>>
>> assert(b.bar_ == 20); //main.d(15): Error: undefined 
>> identifier 'bar_'
>>
>>
>> regards,
>> r_m_r
>
> So,should I file a new bug?Or it's alright and I don't 
> understand something?

i don't think it's a bug, because you are just setting alias for 
a member. if you remove private from field it would work. i'm 
just wonder why do you want do something like this?


More information about the Digitalmars-d-learn mailing list