SlaterLatiao added inline comments.

================
Comment at: clang/test/CodeGenCXX/data_member_packs.cpp:73
+  // CHECK: i32 @_Z3sumIJiiEEDaDpT_(i32 noundef %ts, i32 noundef %ts1)
+  sum_pack2<int, int>(s6);
+  // Check instantiation of sum(int, long, float, double)
----------------
cjdb wrote:
> This needs to be passed to one of the sum functions and checked that it's 
> generating the correct code.
It's passed to `sum` and generation of `sum(int, int)` is checked.


================
Comment at: clang/test/CodeGenCXX/data_member_packs.cpp:76
+  // CHECK: double @_Z3sumIJilfdEEDaDpT_(i32 noundef %ts, i64 noundef %ts1, 
float noundef %ts3, double noundef %ts5)
+  S4<int, long>{}.sum_pack<float, double>(s7);
+  return 0;
----------------
denik wrote:
> This is a good test case!
> I would also add a test for the partial expansion of the member pack. And 
> also checking the right order of the fields. Something like:
> ```
> template<typename T> constexpr auto foo(T t) { return t; }
> template<typename T, typename ... Ts> constexpr auto foo(T t, Ts ... ts) { 
> return t + 2 * foo(ts...); }
> 
> S1<int, int, int> s = {1,2,3};
> static_assert(foo(s.ts...) == 17);
> ```
> 
We can't check the runtime state in LLVM/Clang tests. I added a test case for 
partial expansion and checked the IR. The order of fields can be checked by 
looking at the order of types in the instantiation of `sum`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D158006

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to