www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19021] New: [REG 2.077] Type merging immutable -> mutable


          Issue ID: 19021
           Summary: [REG 2.077] Type merging immutable -> mutable broken
                    in AST
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: ibuclaw gdcproject.org

Commit that caused regression.


It happen that there are two mutable types T that have different deco, but
point to the same immutable!T because of failure to recognize that T and T are
the same type.

struct MultiwayMerge()
    bool compFront()
        return true;

    struct BinaryHeap(alias less)
        struct Impl
            int _payload;

        void initialize()
            immutable Impl init;

        void checkTypes(T)(immutable T init)
            alias IT = typeof(init);    // immutable(Impl)
            alias MT = T;               // Impl
            static assert(MT.mangleof ==
            static assert(IT.mangleof ==

        // Should be same as MT
        static assert(Impl.mangleof ==

    BinaryHeap!(compFront) _heap;

MultiwayMerge!() multiwayMerge;


What looks to be the case is that mangleToBuffer is called before compFront has
finished its semantic, so the first mutable T does not have pure nothrow  nogc
encoded into its symbol.

Jun 24 2018