Disabling opAssign in a type disabled all the opAssigns of an aliased type?

aliak something at something.com
Mon Jul 30 19:33:45 UTC 2018


On Monday, 30 July 2018 at 18:47:06 UTC, Alex wrote:
> On Monday, 30 July 2018 at 18:30:16 UTC, aliak wrote:
>> Is this a bug?
>>
>> If not is there a workaround?
>>
>> I would like for the alias this to function as a normal A type 
>> unless B specifically disables certain features, but it seems 
>> weird that disabling one opAssign disables all of them inside 
>> the aliases type but not in the aliasing type?
>>
>>
>> struct A {
>>     void opAssign(int) {}
>> }
>> struct B {
>>     A a;
>>     alias a this;
>>     @disable void opAssign(float);
>> }
>>
>> void main() {
>>     B b;
>>     b = 3;
>> }
>>
>> Error: function `onlineapp.B.opAssign` is not callable because 
>> it is annotated with @disable
>>
>> Cheers,
>> - Ali
>
> What happens if you omit the @disable line?

Compiles ok then.


More information about the Digitalmars-d-learn mailing list