]> gcc.gnu.org Git - gcc.git/commitdiff
d: TypeInfo error when using slice copy on Structs (PR100964)
authorIain Buclaw <ibuclaw@gdcproject.org>
Wed, 9 Jun 2021 17:39:28 +0000 (19:39 +0200)
committerIain Buclaw <ibuclaw@gdcproject.org>
Wed, 9 Jun 2021 18:03:04 +0000 (20:03 +0200)
Known limitation: does not work for struct with postblit or dtor.

gcc/d/ChangeLog:

PR d/100964
* dmd/expression.c (Expression::checkPostblit): Don't generate
TypeInfo when RTTI is disabled.

gcc/testsuite/ChangeLog:

PR d/100964
* gdc.test/compilable/betterCarray.d: Add test cases.

(cherry picked from commit 10d4f283f4177d80cec3c9e8bf447a48cab5bb47)

gcc/d/dmd/expression.c
gcc/testsuite/gdc.test/compilable/betterCarray.d

index c639fd10aae75e4b32470eba45d4849cfc82786a..92ec6ed328ea9f4f1331dcea52a041c3df67a747 100644 (file)
@@ -2655,8 +2655,11 @@ bool Expression::checkPostblit(Scope *sc, Type *t)
     t = t->baseElemOf();
     if (t->ty == Tstruct)
     {
-        // Bugzilla 11395: Require TypeInfo generation for array concatenation
-        semanticTypeInfo(sc, t);
+        if (global.params.useTypeInfo)
+        {
+            // Bugzilla 11395: Require TypeInfo generation for array concatenation
+            semanticTypeInfo(sc, t);
+        }
 
         StructDeclaration *sd = ((TypeStruct *)t)->sym;
         if (sd->postblit)
index 74c80be3b95bd546497a851758c564a2fd247e45..3f48b042bde5515a66803ab90168e7d078c6f2c5 100644 (file)
@@ -15,3 +15,13 @@ int foo(int[] a, int i)
 {
     return a[i];
 }
+
+/**********************************************/
+// https://issues.dlang.org/show_bug.cgi?id=19234
+void issue19234()
+{
+    static struct A {}
+    A[10] a;
+    A[10] b;
+    b[] = a[];
+}
This page took 0.077731 seconds and 5 git commands to generate.