From 258c048f643fff59be15f43f126629a356ef60fa Mon Sep 17 00:00:00 2001 From: Timm Baeder Date: Fri, 4 Jul 2025 16:10:12 +0200 Subject: [clang][bytecode] Fix copy constructors for empty unions (#147050) Nothing to do in that case. --- clang/lib/AST/ByteCode/Compiler.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'clang/lib/AST/ByteCode/Compiler.cpp') diff --git a/clang/lib/AST/ByteCode/Compiler.cpp b/clang/lib/AST/ByteCode/Compiler.cpp index 20580c8..5ed65f2 100644 --- a/clang/lib/AST/ByteCode/Compiler.cpp +++ b/clang/lib/AST/ByteCode/Compiler.cpp @@ -5836,6 +5836,8 @@ bool Compiler::compileConstructor(const CXXConstructorDecl *Ctor) { return false; if (R->isUnion() && Ctor->isCopyOrMoveConstructor()) { + if (R->getNumFields() == 0) + return this->emitRetVoid(Ctor); // union copy and move ctors are special. assert(cast(Ctor->getBody())->body_empty()); if (!this->emitThis(Ctor)) -- cgit v1.1