[clang] [clang][bytecode] Handle trivial CXXInheritedCtorInitExprs (PR #228352)

Timm Baeder via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 2 00:28:03 PDT 2026


https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/228352

None

>From fe35885bed400eb2281f5a68e990c8ec85342956 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timm=20B=C3=A4der?= <tbaeder at redhat.com>
Date: Fri, 2 Oct 2026 09:26:50 +0200
Subject: [PATCH] [clang][bytecode] Handle trivial CXXInheritedCtorInitExprs

---
 clang/lib/AST/ByteCode/Compiler.cpp | 6 ++++--
 clang/test/AST/ByteCode/cxx26.cpp   | 9 +++++++++
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/clang/lib/AST/ByteCode/Compiler.cpp b/clang/lib/AST/ByteCode/Compiler.cpp
index 42859942d2925c1..83cd4c65b33f0bd 100644
--- a/clang/lib/AST/ByteCode/Compiler.cpp
+++ b/clang/lib/AST/ByteCode/Compiler.cpp
@@ -4245,8 +4245,10 @@ template <class Emitter>
 bool Compiler<Emitter>::VisitCXXInheritedCtorInitExpr(
     const CXXInheritedCtorInitExpr *E) {
   const CXXConstructorDecl *Ctor = E->getConstructor();
-  assert(!Ctor->isTrivial() &&
-         "Trivial CXXInheritedCtorInitExpr, implement. (possible?)");
+
+  if (Ctor->isTrivial())
+    return true;
+
   const Function *F = this->getFunction(Ctor);
   if (!F)
     return false;
diff --git a/clang/test/AST/ByteCode/cxx26.cpp b/clang/test/AST/ByteCode/cxx26.cpp
index 68da8bae0e94634..fae162b2c741f75 100644
--- a/clang/test/AST/ByteCode/cxx26.cpp
+++ b/clang/test/AST/ByteCode/cxx26.cpp
@@ -159,3 +159,12 @@ namespace TrivialAssignment {
                                   // both-note {{in call to}}
 
 }
+
+namespace TrivialInheritedCtor {
+  struct S {};
+  template<typename T> struct D : S {
+    D() requires (sizeof(T) > sizeof(char));
+    using S::S;
+  };
+  D<char> d;
+}



More information about the cfe-commits mailing list