https://github.com/akash-manna-sky created https://github.com/llvm/llvm-project/pull/225611
Fixes #158529 Calling a variadic constructor through a `using` declaration used to hit `assert(false && "Can't get arguments from that expression type")` in `cleanupAfterFunctionCall`. The call site is a `CXXInheritedCtorInitExpr`, and the cleanup only knew how to count variadic arguments from a `CallExpr` or `CXXConstructExpr`. A single level of `using` crashed the same way, the second level in the reproducer just adds a frame. This was fixed as a side effect of #207393, which now takes the variadic size from the frame instead of the call expression. Adding the reproducer plus a few value checks (single and double level, mixed vararg types, inside a constexpr function) so it stays fixed. >From 6bab46c7496e10312070dbf156b082d634690ab2 Mon Sep 17 00:00:00 2001 From: Akash Manna <[email protected]> Date: Wed, 23 Sep 2026 12:21:29 +0530 Subject: [PATCH] [clang][bytecode] Add test for variadic inherited constructor calls Calling a variadic constructor through a using-declaration used to assert in cleanupAfterFunctionCall, since the call site is a CXXInheritedCtorInitExpr and the variadic argument count was taken from the call expression. Fixed by 951a60861a99 (#207393), which takes the size from the frame instead. Add the reproducer and a few value checks. Fixes #158529 --- clang/test/AST/ByteCode/records.cpp | 35 +++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/clang/test/AST/ByteCode/records.cpp b/clang/test/AST/ByteCode/records.cpp index 39d2b948ee59f..ee47c8206f4ff 100644 --- a/clang/test/AST/ByteCode/records.cpp +++ b/clang/test/AST/ByteCode/records.cpp @@ -1251,6 +1251,41 @@ namespace InheritedConstructor { constexpr S s(1); } + + namespace GH158529 { + /// Used to assert when popping the variadic arguments of an inherited + /// constructor, since the call site is a CXXInheritedCtorInitExpr. + struct foo { + constexpr foo(int, ...) {} + }; + struct boo : foo { + using foo::foo; + }; + struct bar : boo { + using boo::boo; + }; + bar u(0, 1); + + struct A { + int a; + constexpr A(int a, ...) : a(a) {} + }; + struct B : A { using A::A; }; + struct C : B { using B::B; }; + + constexpr B b(1, 2); + static_assert(b.a == 1, ""); + constexpr C c(3, 4, 5); + static_assert(c.a == 3, ""); + constexpr C c2(6, 7.5, 'c', 8L); + static_assert(c2.a == 6, ""); + + constexpr int f() { + C x(9, 10); + return x.a; + } + static_assert(f() == 9, ""); + } } namespace InvalidCtorInitializer { _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
