Skip to content

Spurious dual-context error #18065

@dlangBugzillaToGithub

Description

@dlangBugzillaToGithub

Andrei Alexandrescu (@andralex) reported this on 2021-11-09T18:05:19Z

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

CC List

  • kinke

Description

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions