mirror of
https://github.com/dlang/dmd.git
synced 2025-04-26 13:10:12 +03:00
parent
6d57da76e4
commit
8db14cf846
2 changed files with 12 additions and 0 deletions
|
@ -3632,6 +3632,7 @@ extern (C++) final class CastExp : UnaExp
|
|||
if (rvalue || !e1.isLvalue())
|
||||
return false;
|
||||
return (to.ty == Tsarray && (e1.type.ty == Tvector || e1.type.ty == Tsarray)) ||
|
||||
(to.ty == Taarray && e1.type.ty == Taarray) ||
|
||||
e1.type.mutableOf.unSharedOf().equals(to.mutableOf().unSharedOf());
|
||||
}
|
||||
|
||||
|
|
11
compiler/test/runnable/test21020.d
Normal file
11
compiler/test/runnable/test21020.d
Normal file
|
@ -0,0 +1,11 @@
|
|||
// https://github.com/dlang/dmd/issues/21020
|
||||
|
||||
shared struct Queue {
|
||||
int[int] map;
|
||||
}
|
||||
|
||||
void main() {
|
||||
auto queue = Queue();
|
||||
(cast(int[int]) queue.map)[1] = 2;
|
||||
assert(queue.map[1] == 2);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue