-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[Clang] Destructor definition is not compiled for local class in generic lambda initializing a variable template #132208
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
Labels
clang:codegen
IR generation bugs: mangling, exceptions, etc.
constexpr
Anything related to constant evaluation
lambda
C++11 lambda expressions
Comments
@llvm/issue-subscribers-clang-codegen Author: None (MagentaTreehouse)
```c++
template <class>
constexpr auto f{[] (auto) {
struct OnScopeExit { ~OnScopeExit() {} }
pending;
}};
int main() {
|
I was going to say it looks like this but this one is fixed in trunk: #115731 |
llvm-sync bot
pushed a commit
to arm/arm-toolchain
that referenced
this issue
Apr 15, 2025
…038) This patch fixes two long-standing bugs that prevent Clang from instantiating local class members inside a dependent context. These bugs were introduced in commits 21eb1af and 919df9d. 21eb1af introduced a concept called eligible methods such that it did an attempt to skip past ineligible method instantiation when instantiating class members. Unfortunately, this broke the instantiation chain for local classes - getTemplateInstantiationPattern() would fail to find the correct definition pattern if the class was defined within a partially transformed dependent context. 919df9d introduced a separate issue by incorrectly copying the DeclarationNameInfo during function definition instantiation from the template pattern, even though that DNI might contain a transformed TypeSourceInfo. Since that TSI was already updated when the declaration was instantiated, this led to inconsistencies. As a result, the final instantiated function could lose track of the transformed declarations, hence we crash: https://compiler-explorer.com/z/vjvoG76Tf. This PR corrects them by 1. Removing the bypass logic for method instantiation. The eligible flag is independent of instantiation and can be updated properly afterward, so skipping instantiation is unnecessary. 2. Carefully handling TypeSourceInfo by creating a new instance that preserves the pattern's source location while using the already transformed type. Fixes llvm/llvm-project#59734 Fixes llvm/llvm-project#132208
var-const
pushed a commit
to ldionne/llvm-project
that referenced
this issue
Apr 17, 2025
This patch fixes two long-standing bugs that prevent Clang from instantiating local class members inside a dependent context. These bugs were introduced in commits 21eb1af and 919df9d. 21eb1af introduced a concept called eligible methods such that it did an attempt to skip past ineligible method instantiation when instantiating class members. Unfortunately, this broke the instantiation chain for local classes - getTemplateInstantiationPattern() would fail to find the correct definition pattern if the class was defined within a partially transformed dependent context. 919df9d introduced a separate issue by incorrectly copying the DeclarationNameInfo during function definition instantiation from the template pattern, even though that DNI might contain a transformed TypeSourceInfo. Since that TSI was already updated when the declaration was instantiated, this led to inconsistencies. As a result, the final instantiated function could lose track of the transformed declarations, hence we crash: https://compiler-explorer.com/z/vjvoG76Tf. This PR corrects them by 1. Removing the bypass logic for method instantiation. The eligible flag is independent of instantiation and can be updated properly afterward, so skipping instantiation is unnecessary. 2. Carefully handling TypeSourceInfo by creating a new instance that preserves the pattern's source location while using the already transformed type. Fixes llvm#59734 Fixes llvm#132208
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
clang:codegen
IR generation bugs: mangling, exceptions, etc.
constexpr
Anything related to constant evaluation
lambda
C++11 lambda expressions
See https://compiler-explorer.com/z/6vneqf93z.
Warning and linker error since Clang 15:
The text was updated successfully, but these errors were encountered: