[Issue 7892] New: Compiler-generated struct copies can result in errors when ctor is @disable'd

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Apr 11 19:23:50 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=7892

           Summary: Compiler-generated struct copies can result in errors
                    when ctor is @disable'd
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: xtzgzorex at gmail.com


--- Comment #0 from Alex Rønne Petersen <xtzgzorex at gmail.com> 2012-04-11 19:24:34 PDT ---
Two such cases:



alexrp at alexrp ~/Projects/tests $ cat test.d
struct S
{
    @disable this();

    this(int x) {}
}

void main()
{
    S f()
    out (result)
    {
    }
    body
    {
        return S(1);
    }
}
alexrp at alexrp ~/Projects/tests $ dmd test.d
test.d(12): Error: variable test.main.f.result initializer required for type
const(S)



alexrp at alexrp ~/Projects/tests $ cat test2.d
struct S
{
    @disable this();

    this(int x) {}
}

interface I
{
    S f();
}

class C
{
    invariant()
    {
    }

    S f()
    {
        return S(1);
    }
}

void main()
{
}
alexrp at alexrp ~/Projects/tests $ dmd test2.d
test2.d(19): Error: variable test2.C.f.__result initializer required for type S



I bet more can be uncovered, but these are the only ones I've run into.

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


More information about the Digitalmars-d-bugs mailing list