public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r10-9899] d: TypeInfo error when using slice copy on Structs (PR100964)
@ 2021-06-09 18:03 Iain Buclaw
0 siblings, 0 replies; only message in thread
From: Iain Buclaw @ 2021-06-09 18:03 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:d660f34b6718c5f107fd1f1a2126aec759a6593b
commit r10-9899-gd660f34b6718c5f107fd1f1a2126aec759a6593b
Author: Iain Buclaw <ibuclaw@gdcproject.org>
Date: Wed Jun 9 19:39:28 2021 +0200
d: TypeInfo error when using slice copy on Structs (PR100964)
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)
Diff:
---
gcc/d/dmd/expression.c | 7 +++++--
gcc/testsuite/gdc.test/compilable/betterCarray.d | 10 ++++++++++
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/gcc/d/dmd/expression.c b/gcc/d/dmd/expression.c
index c639fd10aae..92ec6ed328e 100644
--- a/gcc/d/dmd/expression.c
+++ b/gcc/d/dmd/expression.c
@@ -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)
diff --git a/gcc/testsuite/gdc.test/compilable/betterCarray.d b/gcc/testsuite/gdc.test/compilable/betterCarray.d
index 74c80be3b95..3f48b042bde 100644
--- a/gcc/testsuite/gdc.test/compilable/betterCarray.d
+++ b/gcc/testsuite/gdc.test/compilable/betterCarray.d
@@ -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[];
+}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-06-09 18:03 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-09 18:03 [gcc r10-9899] d: TypeInfo error when using slice copy on Structs (PR100964) Iain Buclaw
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).