[clang] 36207c0 - [clang][bytecode] Handle trivial CXXInheritedCtorInitExprs (#228352)
via cfe-commits
cfe-commits at lists.llvm.org
Sat Oct 3 06:35:39 PDT 2026
Author: Timm Baeder
Date: 2026-10-03T13:35:31Z
New Revision: 36207c0ed8417ceaf9c393d3704833dca9939633
URL: https://github.com/llvm/llvm-project/commit/36207c0ed8417ceaf9c393d3704833dca9939633
DIFF: https://github.com/llvm/llvm-project/commit/36207c0ed8417ceaf9c393d3704833dca9939633.diff
LOG: [clang][bytecode] Handle trivial CXXInheritedCtorInitExprs (#228352)
Added:
Modified:
clang/lib/AST/ByteCode/Compiler.cpp
clang/test/AST/ByteCode/cxx26.cpp
Removed:
################################################################################
diff --git a/clang/lib/AST/ByteCode/Compiler.cpp b/clang/lib/AST/ByteCode/Compiler.cpp
index 01daace5b3c83..e0f2a29860d09 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 68da8bae0e946..fae162b2c741f 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