[PATCH] D145892: [SemaCXX]use CorrectDelayedTyposInExpr in ActOnCXXFoldExpr only when Diag

Erich Keane via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 14 07:07:28 PDT 2023


erichkeane added a comment.

In D145892#4191220 <https://reviews.llvm.org/D145892#4191220>, @HerrCai0907 wrote:

> I cannot find an example that throw `error: expression contains unexpanded parameter pack 'T'` in fold expression because code like ` (foo<T>(10 + (static_cast<U>(1))) + ...);` can be unpack both `T` and `U` in same `...` operator
>
> But this code can be diagnosed correctly
>
>   template <typename... U> struct A {
>     template <typename... T> void foo(T &&...Params) {
>       (foo<T>(1 + (static_cast<U>(1))) + ...); // ok
>   
>       // error: expression contains unexpanded parameter pack 'T'
>       foo<T>((... + static_cast<U>(1)));
>   
>       (foo<T>((... + static_cast<U>(1))) + ...); // ok
>     }
>   };
>
> Should I add this case into test?

I spent some time on this and I can't come up with any counter examples either.  Please add this to the test, add a release note, then this LGTM.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D145892/new/

https://reviews.llvm.org/D145892



More information about the cfe-commits mailing list