Proposed resolution (approved by CWG 2022-08-26):
The instantiation of a fold-expression
(7.5.7 [expr.prim.fold]) produces:
...
[Accepted as a DR at the November, 2022 meeting.]
13.7.4 [temp.variadic] paragraph 10 expands
a fold-expression (including its enclosing parentheses) to an
unparenthesized expression. If interpreted literally, this could
result in reassociation and misinterpretation of the expression. For
example, given:
... k<1, 2, 3> is specified as expanding to int
k<1, 2, 3> = 2 * 1 + (2 + 3); resulting in a value of 7
rather than the intended value of 12.
Further, there is implementation divergence for the following example: gcc and MSVC apply the general expression interpretation
of
template<int ...N> int k = 2 * (... + N);
#include <type_traits>
template<class ...TT>
void f(TT ...tt) {
static_assert(std::is_same_v<decltype((tt, ...)), int&>);
}
template void f(int /*,int*/);
decltype, whereas clang and icc apply
the identifier special case.