[Issue 14252] New: Erroneous dtor attributes check even if the struct returned immediately

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Fri Mar 6 18:51:26 PST 2015


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

          Issue ID: 14252
           Summary: Erroneous dtor attributes check even if the struct
                    returned immediately
           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: k.hara.pg at gmail.com

Following code should work, but doesn't.

struct Variant
{
    this(int) pure {}
    ~this() {}  // impure
}

auto makeVar(int n) pure
{
    return Variant(1);    // line 9
}

void main()
{
    auto v = makeVar(1);
}

test.d(9): Error: pure function 'test.makeVar' cannot call impure function
'test.Variant.~this'

--


More information about the Digitalmars-d-bugs mailing list