Closed Timothy-Liuxf closed 2 days ago
Reduced:
template<class... Args>
struct S {};
struct T{};
struct U{};
template<class... Args>
struct B : S<Args...>, Args... {};
B b{S<T, U>{}};
@llvm/issue-subscribers-clang-frontend
Author: Timothy Liu (Timothy-Liuxf)
When performing a template argument deduction against the synthesized deduction guide auto B(S<Args...>, Args...) -> B<Args...>
, we will exercise the code path for the empty trailing packs
TemplateArgument::getEmptyPack()
creates a TemplateArgument
of kind Pack
, where Args.Args
is null and Args.NumArgs
is 0.
Later in checkDeducedTemplateArguments()
called by PackDeductionScope::finish()
, we seem to overlook the fact that the value of Y
(which is the empty NewPack) can be null and we will then be increasing a potential nullptr YA
:
This is wrong. We shouldn't bump YA
unless we can ensure it's non-null.
Hi!
This issue may be a good introductory issue for people new to working on LLVM. If you would like to work on this issue, your first steps are:
test/
create fine-grained testing targets, so you can e.g. use make check-clang-ast
to only run Clang's AST tests.git clang-format HEAD~1
to format your changes.If you have any further questions about this issue, don't hesitate to ask via a comment in the thread below.
@llvm/issue-subscribers-good-first-issue
Author: Timothy Liu (Timothy-Liuxf)
The following code:
crashes when compiled with Clang 19.1.0 (
clang++ -std=c++20
):which can be compiled with GCC 14.2.
View in Compiler Explorer:
https://gcc.godbolt.org/z/1jca4WMEr