Thread overview
[Issue 6330] New: Cannot disable assignment to a struct.
Jul 16, 2011
David Simcha
Nov 13, 2011
Kenji Hara
Nov 14, 2011
Walter Bright
July 16, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6330

           Summary: Cannot disable assignment to a struct.
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Keywords: accepts-invalid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: dsimcha@yahoo.com


--- Comment #0 from David Simcha <dsimcha@yahoo.com> 2011-07-15 20:07:41 PDT ---
struct S {
    void opAssign(S s) @disable {
        assert(0);  // This fails.
    }
}

void main() {
    S s;
    S s2;
    s2 = s;
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 13, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6330


Kenji Hara <k.hara.pg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch
           Platform|Other                       |All
         OS/Version|Windows                     |All


--- Comment #1 from Kenji Hara <k.hara.pg@gmail.com> 2011-11-13 06:28:58 PST ---
https://github.com/D-Programming-Language/dmd/pull/508

This is parser issue, that the postfix @disable attribute is ignored.

The workaround is moving @disable into head.

struct S {
    @disable void opAssign(S s){
        assert(0);  // This fails.
    }
}
void main() {
    S s;
    S s2;
    s2 = s;
    // Error: function test.S.opAssign is not callable because it is annotated
with @disable
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 14, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6330


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla@digitalmars.com
         Resolution|                            |FIXED


--- Comment #2 from Walter Bright <bugzilla@digitalmars.com> 2011-11-14 13:32:55 PST ---
https://github.com/D-Programming-Language/dmd/commit/f0e2b4950e23c34ec32e4c3b20c7f77639a70673

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------