[Issue 19829] __traits(isSame) returns true for some non-local delegate lambdas even when they are different

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Apr 26 09:43:38 UTC 2019


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

ag0aep6g <ag0aep6g at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
                 CC|                            |ag0aep6g at gmail.com

--- Comment #1 from ag0aep6g <ag0aep6g at gmail.com> ---
Two observations:

1) This prints "true" even though the two lambdas are clearly not the same:

    pragma(msg, __traits(isSame, i => x[i], a => a));

This is a bug in itself.

2) In the original code, when I move `arr` to global scope, then all writelns
correctly print "Different".

This suggests that, in the context of `test` and __traits(isSame, ...), map1
might be considered to not have access to arr.

--


More information about the Digitalmars-d-bugs mailing list