Skip to content
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] Correctly propagate type aliases' unexpanded flags up to lambda #122875

Merged
merged 1 commit into from
Jan 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion clang/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -810,7 +810,7 @@ Bug Fixes to C++ Support
module imports in those situations. (#GH60336)
- Fix init-capture packs having a size of one before being instantiated. (#GH63677)
- Clang now preserves the unexpanded flag in a lambda transform used for pack expansion. (#GH56852), (#GH85667),
(#GH99877).
(#GH99877), (#GH122417).
Copy link
Contributor

@cor3ntin cor3ntin Jan 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's up with that formatting? 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing wrong with that, this is just another case falling into that entry - we should have fixed this one in that PR :)

- Fixed a bug when diagnosing ambiguous explicit specializations of constrained member functions.
- Fixed an assertion failure when selecting a function from an overload set that includes a
specialization of a conversion function template.
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/Sema/TreeTransform.h
Original file line number Diff line number Diff line change
Expand Up @@ -8496,7 +8496,7 @@ TreeTransform<Derived>::TransformDeclStmt(DeclStmt *S) {
getSema()
.getASTContext()
.getTypeDeclType(TD)
.getCanonicalType()
.getSingleStepDesugaredType(getSema().getASTContext())
->containsUnexpandedParameterPack();

if (auto *VD = dyn_cast<VarDecl>(Transformed))
Expand Down
6 changes: 6 additions & 0 deletions clang/test/SemaCXX/fold_lambda_with_variadics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ struct identity {
using type = T;
};

template <class> using ElementType = int;

template <class = void> void f() {

static_assert([]<class... Is>(Is... x) {
Expand Down Expand Up @@ -47,6 +49,10 @@ template <class = void> void f() {
}(), ...);
}(1, 2);

[]<class... Is>(Is...) {
([] { using T = ElementType<Is>; }(), ...);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of curiosity were applying the getCanonicalType to T and getting int while we really wanted ElementType<Is>?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's exactly why the issue arises.

}(1);

[](auto ...y) {
([y] { }(), ...);
}();
Expand Down
Loading