Issue 11505 - Bad error message: "opAssign [...] is annotated with @disable"
Summary: Bad error message: "opAssign [...] is annotated with @disable"
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 regression
Assignee: No Owner
URL:
Keywords: diagnostic, pull, rejects-valid
Depends on:
Blocks:
 
Reported: 2013-11-12 11:10 UTC by Lars T. Kyllingstad
Modified: 2013-11-30 10:55 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Lars T. Kyllingstad 2013-11-12 11:10:07 UTC
Reduced test case:

    struct Foo
    {
        Bar b;
        unittest
        {
            Foo f;
            f = Foo();
        }
    }

    struct Bar
    {
        ~this() @safe { }
        struct Inner { }
        Inner* i;
    }

As far as I can tell, the above is valid code, but when I run "dmd -c -unittest test.d", DMD spits out:

test.d(7): Error: function test.Foo.opAssign is not callable because it is annotated with @disable
Comment 2 github-bugzilla 2013-11-30 10:54:11 UTC
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/a113001ef631df28109d444edc493cd4ac5842b8
fix Issue 11505 - Bad error message: "opAssign [...] is annotated with @disable"

https://github.com/D-Programming-Language/dmd/commit/58562d274cd81e581eef260d1be6bdea8ceeba15
Merge pull request #2804 from 9rnsr/fix11505

[REG2.064] Issue 11505 - Bad error message: "opAssign [...] is annotated with @disable"
Comment 3 Martin Nowak 2013-11-30 10:55:22 UTC
> If struct field has @safe ~this(), enclosing struct should try to generate @trusted opAssign to use void initializer.

https://github.com/D-Programming-Language/dmd/pull/2804#issuecomment-29147573