www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18430] New: isSame is wrong for non global lambdas


          Issue ID: 18430
           Summary: isSame is wrong for non global lambdas
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: ilyayaroshenko gmail.com

template Alias(alias a)
    alias Alias = a;

auto foo()
    auto scale = 4;
    alias edentity = a => a * scale;
    static assert(__traits(isSame, Alias!edentity, edentity)); // fails in

Mir Algorithm uses this technique a lot to reduce template bloat. It does not
compiles with dmd-nightly now,
see CI https://travis-ci.org/libmir/mir-algorithm/jobs/339855290

Feb 12 2018