[Issue 18541] New: comparison `==` of two typeid() should always be rewritten as a "is"

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Mar 1 11:12:44 UTC 2018


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

          Issue ID: 18541
           Summary: comparison `==` of two typeid() should always be
                    rewritten as a "is"
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: b2.temp at gmx.com

I cant see why anyone would want a full bit per bit comparison of the result of
two `typeid()` since `typeid()` returns static instances, shared for each stuff
of a given type. The idea is to have an AST rewrite of

`typeid(T1) == typeid(T2)`  

    as 

`typeid(T1) is typeid(T2)`


which is compiled as faster code.

--


More information about the Digitalmars-d-bugs mailing list