Author: Timm Baeder
Date: 2026-07-13T14:04:08+02:00
New Revision: a4364df185433cd37b793aa4ff64cba1c72dcbda

URL: 
https://github.com/llvm/llvm-project/commit/a4364df185433cd37b793aa4ff64cba1c72dcbda
DIFF: 
https://github.com/llvm/llvm-project/commit/a4364df185433cd37b793aa4ff64cba1c72dcbda.diff

LOG: [clang][bytecode] Handle invalid function in CXXInheritedCtorInitExpr 
(#209138)

Added: 
    

Modified: 
    clang/lib/AST/ByteCode/Compiler.cpp
    clang/test/AST/ByteCode/invalid.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/ByteCode/Compiler.cpp 
b/clang/lib/AST/ByteCode/Compiler.cpp
index 54aa505a7d306..113bf3c964421 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

Reply via email to