[Issue 13187] New: Function wrongly deduced as pure

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Jul 22 08:19:22 PDT 2014


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

          Issue ID: 13187
           Summary: Function wrongly deduced as pure
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: DMD
          Assignee: nobody at puremagic.com
          Reporter: schuetzm at gmx.net

This compiles:

    int function(int) pure my_func_ptr;

    struct WronglyPure {
        static opDispatch(string fn, Args...)(Args args) {
            return mixin(fn)(args);
        }
    }

    int test() pure {
        return WronglyPure.my_func_ptr(1);
    }

Evidently, `opDispatch` is deduced as pure, but it shouldn't be, because it
access the global variable `my_func_ptr`.

--


More information about the Digitalmars-d-bugs mailing list