https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/209138
None >From c1b66a62a6079c06ce71f07856dfa1684c8aaac8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= <[email protected]> Date: Mon, 13 Jul 2026 11:18:19 +0200 Subject: [PATCH] [clang][bytecode] Handle invalid function in CXXInheritedCtorInitExpr --- clang/lib/AST/ByteCode/Compiler.cpp | 3 ++- clang/test/AST/ByteCode/invalid.cpp | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/clang/lib/AST/ByteCode/Compiler.cpp b/clang/lib/AST/ByteCode/Compiler.cpp index a50980d23d3b2..908e9a81c19ca 100644 --- a/clang/lib/AST/ByteCode/Compiler.cpp +++ b/clang/lib/AST/ByteCode/Compiler.cpp @@ -4140,7 +4140,8 @@ bool Compiler<Emitter>::VisitCXXInheritedCtorInitExpr( assert(!Ctor->isTrivial() && "Trivial CXXInheritedCtorInitExpr, implement. (possible?)"); const Function *F = this->getFunction(Ctor); - assert(F); + if (!F) + return false; assert(!F->hasRVO()); assert(F->hasThisPointer()); diff --git a/clang/test/AST/ByteCode/invalid.cpp b/clang/test/AST/ByteCode/invalid.cpp index 930565181b202..0e6d2d4b508b8 100644 --- a/clang/test/AST/ByteCode/invalid.cpp +++ b/clang/test/AST/ByteCode/invalid.cpp @@ -227,3 +227,17 @@ namespace DefinitionInBody { return 5; } } + +namespace InheritedCtor { + struct S { + constexpr S(int = ; // both-note {{to match this}} \ + // both-error {{expected ';' at end of declaration list}} \ + // both-error {{expected expression}} + }; // both-error {{expected ')'}} + + struct SS : S { + using S::S; + }; + + SS ss{42}; +} _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
