www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19130] New: Disabling opAssign in aliasing struct hides all


          Issue ID: 19130
           Summary: Disabling opAssign in aliasing struct hides all
                    opAssigns in subtyped alias
           Product: D
           Version: D2
          Hardware: x86
                OS: Mac OS X
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: ali.akhtarzada gmail.com

struct A {
    void opAssign(int) {}
struct B {
    A a;
    alias a this;
     disable void opAssign(string) {};

void main() {
    B b;
    b = 3;

Produces Error: function `onlineapp.B.opAssign` is not callable because it is
annotated with  disable

This kind of functionality is very useful for proxy types that have an alias T
this, but want to disable copying (i.e this(this) and copy opAssign)

Jul 30 2018