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

Congcong Cai via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 13 16:28:30 PDT 2023


HerrCai0907 added a comment.

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?


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