D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 11187 - A small transitive const bug on struct copying
Summary: A small transitive const bug on struct copying
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords: pull, rejects-valid
Depends on:
Blocks:
 
Reported: 2013-10-06 23:38 UTC by Kenji Hara
Modified: 2013-10-07 17:09 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Kenji Hara 2013-10-06 23:38:55 UTC
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
}
Comment 2 github-bugzilla 2013-10-07 12:38:11 UTC
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/dd2d3060854f68042740b8b447387e55323e6c47
fix Issue 11187 - A small transitive const bug on struct copying

https://github.com/D-Programming-Language/dmd/commit/a5041a6a563c2893d707737e5c602f0b4b488180
Merge pull request #2639 from 9rnsr/fix11187

Issue 11187 - A small transitive const bug on struct copying