llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: Younan Zhang (zyn0217) <details> <summary>Changes</summary> It turns out that PackIndexingExpr doesn't create any PackExpansionTypes for unexpanded packs and thus we don't have to remove the packs during the normalization. This backports https://github.com/llvm/llvm-project/pull/218577 --- Full diff: https://github.com/llvm/llvm-project/pull/220156.diff 2 Files Affected: - (modified) clang/lib/Sema/SemaConcept.cpp (+6) - (modified) clang/test/SemaCXX/cxx2c-fold-exprs.cpp (+30) ``````````diff diff --git a/clang/lib/Sema/SemaConcept.cpp b/clang/lib/Sema/SemaConcept.cpp index 476910a9db528..da0b9700504b9 100644 --- a/clang/lib/Sema/SemaConcept.cpp +++ b/clang/lib/Sema/SemaConcept.cpp @@ -267,6 +267,12 @@ class AdjustConstraints : public TreeTransform<AdjustConstraints> { return Result; } + QualType TransformPackIndexingType(TypeLocBuilder &TLB, + PackIndexingTypeLoc TL) { + llvm::SaveAndRestore _1(RemoveNonPackExpansionPacks, false); + return inherited::TransformPackIndexingType(TLB, TL); + } + bool AlreadyTransformed(QualType T) { if (T.isNull()) return true; diff --git a/clang/test/SemaCXX/cxx2c-fold-exprs.cpp b/clang/test/SemaCXX/cxx2c-fold-exprs.cpp index 0312022912dca..87a3b311857f4 100644 --- a/clang/test/SemaCXX/cxx2c-fold-exprs.cpp +++ b/clang/test/SemaCXX/cxx2c-fold-exprs.cpp @@ -598,3 +598,33 @@ static_assert(MutabilityAlias<Constant::alias>); static_assert(MutabilityAlias<Mutable::alias>); } + +namespace GH218035 { + +template <class T, class UnusedParam> +concept same_as_impl = sizeof(T) == 8; +template <typename... P> +void f() + requires(same_as_impl<P...[0], P> && ...) +{} +void g() { f<long long, float>(); } + +} + +namespace GH218548 { + +template <class T> +concept same_as_impl = sizeof(T) == 2; +template <typename... P> +void f() requires(same_as_impl<P...[sizeof(P)]> && ...) // #GH218548_f +{} +void g() { + f<char, short, short>(); + + f<char, int, short>(); + // expected-error@-1 {{no matching function}} + // expected-note@#GH218548_f {{constraints not satisfied}} + // expected-note@#GH218548_f {{invalid index}} +} + +} `````````` </details> https://github.com/llvm/llvm-project/pull/220156 _______________________________________________ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
