www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22497] New: Spurious dual-context error

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

          Issue ID: 22497
           Summary: Spurious dual-context error
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: blocker
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: andrei erdani.com

Consider:

template canon(string v) {
    auto fun(alias lambda)(int x) {
        return lambda(x);
    }
}

alias f1 = canon!"abc".fun;

void main() {
    int x = 42;
    f1!(y => y + x)(1);
}

The code produces the error:

Deprecation: function `onlineapp.main.f1!((y) => y + x).fun` function requires
a dual-context, which is deprecated

There is no dual context anywhere in sight. The canon template takes a
compile-time string, which requires no context.

This blocks phobos versioning.

--
Nov 09 2021