https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/205555
They don't produce a value and for us, that means we just need to ignore them and not initialize anything. >From 090b61456b34e16ca76b77e4f26ef71173ddb0f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= <[email protected]> Date: Wed, 24 Jun 2026 15:13:26 +0200 Subject: [PATCH] indet --- clang/lib/AST/ByteCode/Compiler.cpp | 9 +++++++++ clang/test/AST/ByteCode/evaluate-dtor-codegen.cpp | 14 ++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 clang/test/AST/ByteCode/evaluate-dtor-codegen.cpp diff --git a/clang/lib/AST/ByteCode/Compiler.cpp b/clang/lib/AST/ByteCode/Compiler.cpp index 9444eeb0c2ad3..d3f64776b2652 100644 --- a/clang/lib/AST/ByteCode/Compiler.cpp +++ b/clang/lib/AST/ByteCode/Compiler.cpp @@ -5419,6 +5419,7 @@ bool Compiler<Emitter>::visitDtorCall(const VarDecl *VD, const APValue &Value) { template <class Emitter> bool Compiler<Emitter>::visitAPValue(const APValue &Val, PrimType ValType, const Expr *E) { + assert(!Val.isIndeterminate() && "Needs to be checked before"); assert(!DiscardResult); if (Val.isInt()) return this->emitConst(Val.getInt(), ValType, E); @@ -5508,6 +5509,8 @@ bool Compiler<Emitter>::visitAPValueInitializer(const APValue &Val, assert(R); for (unsigned I = 0, N = Val.getStructNumFields(); I != N; ++I) { const APValue &F = Val.getStructField(I); + if (F.isIndeterminate()) + continue; const Record::Field *RF = R->getField(I); QualType FieldType = RF->Decl->getType(); @@ -5530,6 +5533,8 @@ bool Compiler<Emitter>::visitAPValueInitializer(const APValue &Val, // Bases. for (unsigned I = 0, N = Val.getStructNumBases(); I != N; ++I) { const APValue &B = Val.getStructBase(I); + if (B.isIndeterminate()) + continue; const Record::Base *RB = R->getBase(I); QualType BaseType = Ctx.getASTContext().getCanonicalTagType(RB->Decl); @@ -5550,6 +5555,8 @@ bool Compiler<Emitter>::visitAPValueInitializer(const APValue &Val, const Record *R = this->getRecord(T); assert(R); const APValue &F = Val.getUnionValue(); + if (F.isIndeterminate()) + return true; const Record::Field *RF = R->getField(UnionField); QualType FieldType = RF->Decl->getType(); @@ -5580,6 +5587,8 @@ bool Compiler<Emitter>::visitAPValueInitializer(const APValue &Val, const APValue &Elem = A >= InitializedElems ? Val.getArrayFiller() : Val.getArrayInitializedElt(A); + if (Elem.isIndeterminate()) + continue; if (ElemT) { if (!this->visitAPValue(Elem, *ElemT, E)) diff --git a/clang/test/AST/ByteCode/evaluate-dtor-codegen.cpp b/clang/test/AST/ByteCode/evaluate-dtor-codegen.cpp new file mode 100644 index 0000000000000..24b17cceb8e41 --- /dev/null +++ b/clang/test/AST/ByteCode/evaluate-dtor-codegen.cpp @@ -0,0 +1,14 @@ +// RUN: %clang_cc1 -std=c++20 -verify=both,expected %s -Wexit-time-destructors -fexperimental-new-constant-interpreter +// RUN: %clang_cc1 -std=c++20 -verify=both,ref %s -Wexit-time-destructors + +// both-no-diagnostics + +struct S { + int a; + constexpr S() {} + constexpr ~S() { + } +}; +S s{}; + + _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
