[Issue 15125] New: Explicit pure needed even though pure: at the top of the file

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Sep 28 07:41:41 PDT 2015


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

          Issue ID: 15125
           Summary: Explicit pure needed even though pure: at the top of
                    the file
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: atila.neves at gmail.com

The code below fails to compile, saying that `throwMyException` can't call the
MyException constructor because it's not pure, even though there's a `pure:` at
the top. Adding `pure` explicitly to the constructor makes the error go away.

@safe:
pure:

class MyException: Exception {
    this() {
        super("");
    }
}


void throwMyException() {
    throw new MyException();
}

--


More information about the Digitalmars-d-bugs mailing list