[Issue 12686] New: Struct invariant prevents NRVO

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Apr 30 09:27:40 PDT 2014


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: nobody at puremagic.com
          Reporter: bugzilla at kyllingen.net

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.

--


More information about the Digitalmars-d-bugs mailing list