[clang] [clang][bytecode] Handle trivial CXXInheritedCtorInitExprs (PR #228352)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 2 00:28:50 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Timm Baeder (tbaederr)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/228352.diff
2 Files Affected:
- (modified) clang/lib/AST/ByteCode/Compiler.cpp (+4-2)
- (modified) clang/test/AST/ByteCode/cxx26.cpp (+9)
``````````diff
diff --git a/clang/lib/AST/ByteCode/Compiler.cpp b/clang/lib/AST/ByteCode/Compiler.cpp
index 42859942d2925..83cd4c65b33f0 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;
+}
``````````
</details>
https://github.com/llvm/llvm-project/pull/228352
More information about the cfe-commits
mailing list