www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18296] New: [Reg2.078.1] invalid code with coverage and copy

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

          Issue ID: 18296
           Summary: [Reg2.078.1] invalid code with coverage and copy
                    construction
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Keywords: wrong-code
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: code dawg.eu

cat > bug.d << CODE
alias AliasSeq(Args...) = Args;

struct Duration
{
    this(long hnsecs)
    {
        _hnsecs = hnsecs;
    }


    long _hnsecs;
}

void main()
{
    foreach(U; AliasSeq!(Duration, const Duration))
    {
        const Duration t = 42;
        U u = t;
        assert(t._hnsecs == u._hnsecs);
    }
}
CODE

dmd -cov -run bug.d

--
Jan 24