aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorNathaniel Shead <nathanieloshead@gmail.com>2024-10-24 18:10:52 +1100
committerNathaniel Shead <nathanieloshead@gmail.com>2024-10-25 08:38:00 +1100
commit6aba48a8cc128e54ee243d451ac9a843ff41c4f9 (patch)
tree6379c1e242a9ab4a1c0f76b060a81d2ecdb8ded9 /gcc/cp
parent29efc621b7c66ec67d10fc87cddbb3f1ab709fb2 (diff)
downloadgcc-6aba48a8cc128e54ee243d451ac9a843ff41c4f9.zip
gcc-6aba48a8cc128e54ee243d451ac9a843ff41c4f9.tar.gz
gcc-6aba48a8cc128e54ee243d451ac9a843ff41c4f9.tar.bz2
c++/modules: Propagate some missing flags on type definitions
Noticed while testing my fix for PR c++/113814. Not all of these are easily testable but I've tested a couple that were straight-forward. For consistency also adds a new TYPE_WARN_IF_NOT_ALIGN_RAW flag to match the decl version Nathan added. gcc/cp/ChangeLog: * module.cc (trees_in::read_class_def): Propagate some missing flags from the streamed-in definition. gcc/ChangeLog: * tree.h (TYPE_WARN_IF_NOT_ALIGN_RAW): New accessor. (TYPE_WARN_IF_NOT_ALIGN): Use it. (SET_TYPE_WARN_IF_NOT_ALIGN): Likewise. gcc/testsuite/ChangeLog: * g++.dg/modules/class-10_a.H: New test. * g++.dg/modules/class-10_b.C: New test. Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/module.cc20
1 files changed, 19 insertions, 1 deletions
diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc
index 90ad67d..297ef85bb 100644
--- a/gcc/cp/module.cc
+++ b/gcc/cp/module.cc
@@ -12379,8 +12379,12 @@ trees_in::read_class_def (tree defn, tree maybe_template)
/* Core pieces. */
TYPE_MODE_RAW (type) = TYPE_MODE_RAW (type_dup);
+ TYPE_ALIGN_RAW (type) = TYPE_ALIGN_RAW (type_dup);
+ TYPE_WARN_IF_NOT_ALIGN_RAW (type)
+ = TYPE_WARN_IF_NOT_ALIGN_RAW (type_dup);
+ TYPE_USER_ALIGN (type) = TYPE_USER_ALIGN (type_dup);
+
SET_DECL_MODE (defn, DECL_MODE (maybe_dup));
- TREE_ADDRESSABLE (type) = TREE_ADDRESSABLE (type_dup);
DECL_SIZE (defn) = DECL_SIZE (maybe_dup);
DECL_SIZE_UNIT (defn) = DECL_SIZE_UNIT (maybe_dup);
DECL_ALIGN_RAW (defn) = DECL_ALIGN_RAW (maybe_dup);
@@ -12388,12 +12392,26 @@ trees_in::read_class_def (tree defn, tree maybe_template)
= DECL_WARN_IF_NOT_ALIGN_RAW (maybe_dup);
DECL_USER_ALIGN (defn) = DECL_USER_ALIGN (maybe_dup);
+ TYPE_TYPELESS_STORAGE (type) = TYPE_TYPELESS_STORAGE (type_dup);
+ TYPE_CXX_ODR_P (type) = TYPE_CXX_ODR_P (type_dup);
+ TYPE_NO_FORCE_BLK (type) = TYPE_NO_FORCE_BLK (type_dup);
+ TYPE_TRANSPARENT_AGGR (type) = TYPE_TRANSPARENT_AGGR (type_dup);
+ TYPE_CONTAINS_PLACEHOLDER_INTERNAL (type)
+ = TYPE_CONTAINS_PLACEHOLDER_INTERNAL (type_dup);
+
+ TYPE_EMPTY_P (type) = TYPE_EMPTY_P (type_dup);
+ TREE_ADDRESSABLE (type) = TREE_ADDRESSABLE (type_dup);
+
/* C++ pieces. */
TYPE_POLYMORPHIC_P (type) = TYPE_POLYMORPHIC_P (type_dup);
+ CLASSTYPE_FINAL (type) = CLASSTYPE_FINAL (type_dup);
+
TYPE_HAS_USER_CONSTRUCTOR (type)
= TYPE_HAS_USER_CONSTRUCTOR (type_dup);
TYPE_HAS_NONTRIVIAL_DESTRUCTOR (type)
= TYPE_HAS_NONTRIVIAL_DESTRUCTOR (type_dup);
+ TYPE_NEEDS_CONSTRUCTING (type)
+ = TYPE_NEEDS_CONSTRUCTING (type_dup);
if (auto ls = TYPE_LANG_SPECIFIC (type_dup))
{