[Issue 22497] New: Spurious dual-context error

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Nov 9 18:05:19 UTC 2021


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 at puremagic.com
          Reporter: andrei at 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.

--


More information about the Digitalmars-d-bugs mailing list