-
Notifications
You must be signed in to change notification settings - Fork 10.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[clang][Sema] Resolving Inconsistent Arguments Panic in Variadic Template Variables #70280
base: main
Are you sure you want to change the base?
Conversation
✅ With the latest revision this PR passed the C/C++ code formatter. |
i will add test case for it |
@knightXun code looks reasonable, ping me when you have tests and a release note :) |
|
…iadic Template Variables When template variables are variadic, sema may panic, potentially leading to a situation where the number of function variables exceeds the number of template variables. The sema compares the template signature and function signature parameters one by one, which can trigger an assertion error. This PR, when encountering variadic templates, avoids comparing the template signature and function signature parameters one by one. issue: llvm#70191
cc @cor3ntin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cor3ntin do this still look good to you?
clang/test/SemaCXX/GH70280.cpp
Outdated
template <typename... c> void d(c...) = d<b, a>(0, ""); // expected-error {{no matching function for call to 'd'}} | ||
// expected-error@-1 {{illegal initializer (only variables can be initialized)}} | ||
// expected-note@-2 {{candidate function template not viable: no known conversion from 'const char[1]' to 'a' (aka 'int') for 2nd argument}} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing EOL
@shafik Yes. It needs to be rebased though |
When template variables are variadic, sema may panic, potentially leading to a situation where the number of function variables exceeds the number of template variables.The sema compares the template signature and function signature parameters one by one, which can trigger an assertion error. This PR, when encountering variadic templates,
avoids comparing the template signature and function signature parameters one by one.
#70191