www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19829] New: __traits(isSame) returns true for some non-local

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

          Issue ID: 19829
           Summary: __traits(isSame) returns true for some non-local
                    delegate lambdas even when they are different
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: simen.kjaras gmail.com

From issue 19828:
import std.stdio : writeln; unittest { int[] arr = [0, 1]; // Different writeln(__traits(isSame, i => arr[i], a => a) ? "Same" : "Different"); // Same test!(i => arr[i], a => a); // Different test!(i => arr[i], a => a * 4); } auto test(alias map1, alias map2)() { writeln(__traits(isSame, map1, map2) ? "Same" : "Different"); } --
Apr 26 2019