Deprecation bug?

Jack Applegame japplegame at gmail.com
Fri Nov 13 10:08:47 UTC 2020


> struct A {
>    void opAssign(int v) const {}
> }
> 
> struct B {
>     enum a = A();
>     alias a this;
> }
> 
> enum BB = B();
> 
> void main() {
>     BB = 10; // Deprecation: Cannot use alias this to partially 
> initialize variable B() of type B. Use a.opAssign
> }

If you change `enum a = A()` to `immutable a = A()`, the 
deprecation disappears.


More information about the Digitalmars-d mailing list