https://issues.dlang.org/show_bug.cgi?id=12686

          Issue ID: 12686
           Summary: Struct invariant prevents NRVO
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: [email protected]
          Reporter: [email protected]

Test case:

   struct Foo
    {
        invariant() { }

        @disable this(this);

        Foo bar()
        {
            Foo f;
            return f;
        }
    }

When presented with the above, DMD complains:

bug.d(10): Error: struct bug.Foo is not copyable because it is annotated with
@disable

If the struct invariant is removed, the code compiles just fine.

--

Reply via email to