www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17641] New: TypeInfo for two identical delegates (or

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 puremagic.com
          Reporter: andronkin 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)".

--
Jul 12 2017