/* When adding a flag here, consider whether or not it ought to
apply to a template instance if it applies to the template. If
- so, make sure to copy it in instantiate_class_template! */
+ so, make sure to copy it in instantiate_class_template!
+
+ Also make sure new flags here are streamed in module.cc. */
/* There are some bits left to fill out a 32-bit word. Keep track
of this by updating the size of this bitfield whenever you add or
WB (lang->declared_class);
WB (lang->diamond_shaped);
WB (lang->repeated_base);
- gcc_assert (!lang->being_defined);
+ gcc_checking_assert (!lang->being_defined);
// lang->debug_requested
WB (lang->fields_readonly);
WB (lang->ptrmemfunc_flag);
WB (lang->has_constexpr_ctor);
WB (lang->unique_obj_representations);
WB (lang->unique_obj_representations_set);
+ gcc_checking_assert (!lang->erroneous);
+ WB (lang->non_pod_aggregate);
+ WB (lang->non_aggregate_pod);
+ WB (lang->trivially_relocatable);
+ WB (lang->trivially_relocatable_computed);
+
+ WB (lang->replaceable);
+ WB (lang->replaceable_computed);
#undef WB
}
RB (lang->declared_class);
RB (lang->diamond_shaped);
RB (lang->repeated_base);
- gcc_assert (!lang->being_defined);
- gcc_assert (!lang->debug_requested);
+ gcc_checking_assert (!lang->being_defined);
+ gcc_checking_assert (!lang->debug_requested);
RB (lang->fields_readonly);
RB (lang->ptrmemfunc_flag);
RB (lang->has_constexpr_ctor);
RB (lang->unique_obj_representations);
RB (lang->unique_obj_representations_set);
+ gcc_checking_assert (!lang->erroneous);
+ RB (lang->non_pod_aggregate);
+ RB (lang->non_aggregate_pod);
+ RB (lang->trivially_relocatable);
+ RB (lang->trivially_relocatable_computed);
+
+ RB (lang->replaceable);
+ RB (lang->replaceable_computed);
#undef RB
return !get_overrun ();
}
--- /dev/null
+// Check for some additional lang_type flags that we'd missed.
+// { dg-additional-options "-fmodule-header -fabi-version=21 -Wabi=15" }
+// { dg-module-cmi {} }
+
+#if __cpp_trivial_relocatability < 202502L
+#define trivially_relocatable_if_eligible __trivially_relocatable_if_eligible
+#define replaceable_if_eligible __replaceable_if_eligible
+#endif
+
+struct A trivially_relocatable_if_eligible { A(A&&); };
+struct B replaceable_if_eligible { B(B&&); B& operator=(B&&); };
+struct C {};
+static_assert(__builtin_is_trivially_relocatable(C) && __builtin_is_replaceable(C), "");
+
+
+struct pr106381 {
+ long l;
+ char c = -1;
+};
+struct L1 : pr106381 {
+ char x; // { dg-warning "offset" "" { target c++14 } }
+};
+static_assert(sizeof(L1) == sizeof(pr106381));
+
+
+struct pr120012 {
+ pr120012(const pr120012&) = default;
+ pr120012(pr120012&&) = default;
+ pr120012& operator=(pr120012&&) = default;
+ unsigned int a;
+ unsigned char b;
+};
+struct L2 : pr120012 {
+ unsigned char y; // { dg-warning "offset" "" { target c++20 } }
+};
+static_assert(sizeof(L2) > sizeof(pr120012));
--- /dev/null
+// { dg-additional-options "-fmodules -fabi-version=21 -Wabi=15" }
+
+import "class-11_a.H";
+
+static_assert(__builtin_is_trivially_relocatable(A), "");
+static_assert(__builtin_is_replaceable(B), "");
+static_assert(__builtin_is_trivially_relocatable(C) && __builtin_is_replaceable(C), "");
+
+struct M1 : pr106381 {
+ char x; // { dg-warning "offset" "" { target c++14 } }
+};
+
+struct M2 : pr120012 {
+ unsigned char y; // { dg-warning "offset" "" { target c++20 } }
+};