aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/d/types.cc10
-rw-r--r--gcc/testsuite/gdc.dg/pr98427.d23
2 files changed, 31 insertions, 2 deletions
diff --git a/gcc/d/types.cc b/gcc/d/types.cc
index 94aa1f6..acb8c40 100644
--- a/gcc/d/types.cc
+++ b/gcc/d/types.cc
@@ -964,7 +964,10 @@ public:
if (!t->sym->isPOD ())
{
for (tree tv = t->ctype; tv != NULL_TREE; tv = TYPE_NEXT_VARIANT (tv))
- TREE_ADDRESSABLE (tv) = 1;
+ {
+ TREE_ADDRESSABLE (tv) = 1;
+ SET_TYPE_MODE (tv, BLKmode);
+ }
}
}
@@ -999,7 +1002,10 @@ public:
/* Classes only live in memory, so always set the TREE_ADDRESSABLE bit. */
for (tree tv = basetype; tv != NULL_TREE; tv = TYPE_NEXT_VARIANT (tv))
- TREE_ADDRESSABLE (tv) = 1;
+ {
+ TREE_ADDRESSABLE (tv) = 1;
+ SET_TYPE_MODE (tv, BLKmode);
+ }
/* Type is final, there are no derivations. */
if (t->sym->storage_class & STCfinal)
diff --git a/gcc/testsuite/gdc.dg/pr98427.d b/gcc/testsuite/gdc.dg/pr98427.d
new file mode 100644
index 0000000..225db8b
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/pr98427.d
@@ -0,0 +1,23 @@
+// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98427
+// { dg-do compile }
+// { dg-options "-O2 -fno-inline" }
+
+@trusted memoizeExpr()
+{
+ struct CodepointSet
+ {
+ struct CowArray
+ {
+ uint *ptr;
+ }
+
+ const CodepointSet binary(U)(U rhs)
+ {
+ return rhs;
+ }
+
+ CowArray array;
+ }
+
+ CodepointSet().binary(CodepointSet());
+}