================
@@ -25,15 +25,34 @@ InterpStack::~InterpStack() {
     std::free(Chunk->Next);
   if (Chunk)
     std::free(Chunk);
+
+#if __has_cpp_attribute(no_unique_address)
+#ifdef __GNUC__
+#pragma GCC diagnostic push
+// Clang and GCC complain that `offsetof` isn't allowed on non-standard-layout
+// types. However, it works just fine.
+#pragma GCC diagnostic ignored "-Winvalid-offsetof"
+#endif
+  TYPE_SWITCH(PrimType(), {
+    using Frame = StackFrame<T>;
+    static_assert(offsetof(Frame, type) == sizeof(Frame) - 1);
+    // Currently we don't need to use extra memory to store the type 
information
+    // for any PrimType on 64 bit platforms. Nothing breaks if this changes, 
but
+    // it would result in 8 extra bytes used just for the type information.
----------------
tbaederr wrote:

Just to clarify: If that changes, this assertion will fail? And in that case, 
the assertion should just be removed?

https://github.com/llvm/llvm-project/pull/224903
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to