[Issue 17641] New: TypeInfo for two identical delegates (or functions) are not equal to each other

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Jul 12 08:55:07 PDT 2017


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

          Issue ID: 17641
           Summary: TypeInfo for two identical delegates (or functions)
                    are not equal to each other
           Product: D
           Version: D2
          Hardware: All
                OS: Windows
            Status: NEW
          Severity: major
          Priority: P1
         Component: druntime
          Assignee: nobody at puremagic.com
          Reporter: andronkin at gmail.com

Example:

auto d1 = delegate void(uint a) {};
auto d2 = delegate void(uint a) {};

assert(typeid(d1) is typeid(d2)); // OK

But in another case:

auto d1 = delegate void(uint a) { writeln(a); };
auto d2 = delegate void(uint a) {};

assert(typeid(d1) is typeid(d2)); // FAILED! Although type hasn't been
changed...

Also, the string representation of typeid(d1) is "void delegate()", although
there must be a "void delegate(uint)".

--


More information about the Digitalmars-d-bugs mailing list