http://d.puremagic.com/issues/show_bug.cgi?id=8944

           Summary: Loosing const from shared const type when unqualifying
                    in foreach over tuple
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: verylonglogin....@gmail.com


--- Comment #0 from Denis Shelomovskij <verylonglogin....@gmail.com> 2012-11-02 
20:34:54 MSK ---
---
template TypeTuple(TList...)
{ alias TList TypeTuple; }

void main()
{
    foreach(T; TypeTuple!(shared void*, const shared void*))
    {
        static      if (is(T U == shared const U)) alias U TU;
        else static if (is(T U == shared       U)) alias U TU;
        else static assert(0);

        pragma(msg, "T:  ", T, "\nTU: ", TU, "\n");

        static if(is(T P == P*))
        static if(is(TU PU == PU*))
            static assert(is(P == PU)); // fails on second iteration

        T t;
        bool b = is(typeof(cast(TU*) &t = null)); // comment to hide a bug
    }
}
---

Output:
---
T:  shared(void*)
TU: shared(void)*

T:  shared(const(void*))
TU: shared(void)*

main.d(16): Error: static assert  (is(shared(const(void)) == shared(void))) is
false
---
Second `TU` should be `shared(const(void))*`.

As always, such (unexpected) template bugs are hard to figure out.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to