Bug 11187 – A small transitive const bug on struct copying

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-10-06T23:38:00Z
Last change time
2013-10-07T17:09:26Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
k.hara.pg

Comments

Comment #0 by k.hara.pg — 2013-10-06T23:38:55Z
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 #1 by k.hara.pg — 2013-10-06T23:48:29Z
Comment #2 by github-bugzilla — 2013-10-07T12:38:11Z
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