[Issue 15916] New: void makes a function impure + system

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Apr 12 11:09:09 PDT 2016


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

          Issue ID: 15916
           Summary: void makes a function impure + system
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: greeenify at gmail.com

auto myfun(int foo)
{
    auto b = foo;
}

pure @safe nothrow unittest
{
    myfun(2);
}

However once the return type is void - the compiler tells me that I have an
impure system function!
Is this by design or a bug?

void myfunv()
{
    int b = 2;
}

pure @safe nothrow unittest
{
    myfunv();
}

(removing/adding the parameter doesn't make a difference)

--


More information about the Digitalmars-d-bugs mailing list