[Issue 11187] New: A small transitive const bug on struct copying

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Oct 6 23:38:56 PDT 2013


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

           Summary: A small transitive const bug on struct copying
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: k.hara.pg at gmail.com


--- Comment #0 from Kenji Hara <k.hara.pg at gmail.com> 2013-10-06 23:38:55 PDT ---
The copy conversion from const S to S should work, because the field S.cx.arr
has same qualified type const(int[]).

struct X
{
    int[] arr;
}
struct S
{
    const(X) cx;
}
void main()
{
    static assert(is(typeof((const S).init.cx.arr) == const(int[])));
    static assert(is(typeof((      S).init.cx.arr) == const(int[])));
    const S sc;
    S sm = sc;      // fails, but should work
    static assert(is(const S : S));     // fails, but should work
}

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


More information about the Digitalmars-d-bugs mailing list