]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
d: Indexing a cast(AA) yields no lvalue anymore
authorIain Buclaw <ibuclaw@gdcproject.org>
Sat, 22 Mar 2025 09:33:24 +0000 (10:33 +0100)
committerIain Buclaw <ibuclaw@gdcproject.org>
Sat, 22 Mar 2025 09:55:13 +0000 (10:55 +0100)
gcc/d/ChangeLog:

* dmd/MERGE: Merge upstream dmd 8db14cf846.

Reviewed-on: https://github.com/dlang/dmd/pull/21029

gcc/d/dmd/MERGE
gcc/d/dmd/expression.d
gcc/testsuite/gdc.test/runnable/test21020.d [new file with mode: 0644]

index 1be4da416f45eeb2906f308ccff377fb80d642a3..f274580f2d60a8b6fdbccbb4475de05425db06e6 100644 (file)
@@ -1,4 +1,4 @@
-fde0f8c40a1b8eb78c3485cb0e940035bfe6fb00
+8db14cf8467ca25256904d51169b176c9c89afb1
 
 The first line of this file holds the git revision number of the last
 merge done from the dlang/dmd repository.
index ef5c0b09eb457d3913e7049a99ca1638e029734b..4bf1f9f25f864b2bf4330ec0258dc6dc5b599c58 100644 (file)
@@ -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());
     }
 
diff --git a/gcc/testsuite/gdc.test/runnable/test21020.d b/gcc/testsuite/gdc.test/runnable/test21020.d
new file mode 100644 (file)
index 0000000..484db30
--- /dev/null
@@ -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);
+}