-
Notifications
You must be signed in to change notification settings - Fork 11.2k
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 ICE for template friend in templated class with constrained parameter that declares a lambda or class method #75426
Labels
clang:frontend
Language frontend issues, e.g. anything involving "Sema"
confirmed
Verified by a second party
crash
Prefer [crash-on-valid] or [crash-on-invalid]
Comments
github-actions
bot
added
the
clang
Clang issues not falling into any other category
label
Dec 14, 2023
EugeneZelenko
added
clang:frontend
Language frontend issues, e.g. anything involving "Sema"
crash
Prefer [crash-on-valid] or [crash-on-invalid]
and removed
clang
Clang issues not falling into any other category
labels
Dec 14, 2023
@llvm/issue-subscribers-clang-frontend Author: None (antangelo)
The following examples trigger an assertion failure on trunk (since clang 16). They compile fine on clang 15. The assertion failure for both examples is the same.
The first uses a class method: template<typename T> concept C = true;
struct A {
template<C T> void f();
};
template<typename X>
class B {
template<C T> friend void A::f();
}; https://godbolt.org/z/sq7fe9ed1 The second uses a lambda call operator: template<typename T> concept C = true;
auto L = []<C T>{};
template<typename X>
class B {
template<C T> friend void decltype(L)::operator()();
}; https://godbolt.org/z/h4YYTYnqE The stack trace for the first is below, though both hit the same assertion.
|
Looks like a regression. |
antangelo
added a commit
that referenced
this issue
Jan 12, 2024
…stantiation args (#77552) Fixes a crash where the template argument depth computed in the semantic context for a friend FunctionDecl with a constrained parameter is compared against arguments in the lexical context for the purpose of checking if the constraint depends on enclosing template parameters. Since getTemplateInstantiationArgs in this case follows the semantic DC for friend FunctionDecls, the resulting depth is incorrect and trips an assertion. Fixes #75426
justinfargnoli
pushed a commit
to justinfargnoli/llvm-project
that referenced
this issue
Jan 28, 2024
…stantiation args (llvm#77552) Fixes a crash where the template argument depth computed in the semantic context for a friend FunctionDecl with a constrained parameter is compared against arguments in the lexical context for the purpose of checking if the constraint depends on enclosing template parameters. Since getTemplateInstantiationArgs in this case follows the semantic DC for friend FunctionDecls, the resulting depth is incorrect and trips an assertion. Fixes llvm#75426
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
clang:frontend
Language frontend issues, e.g. anything involving "Sema"
confirmed
Verified by a second party
crash
Prefer [crash-on-valid] or [crash-on-invalid]
The following examples trigger an assertion failure on trunk (since clang 16). They compile fine on clang 15. The assertion failure for both examples is the same.
The first uses a class method:
https://godbolt.org/z/sq7fe9ed1
The second uses a lambda call operator:
https://godbolt.org/z/h4YYTYnqE
The stack trace for the first is below, though both hit the same assertion.
The text was updated successfully, but these errors were encountered: