【发布时间】:2018-04-08 21:31:05
【问题描述】:
考虑以下代码sn-p:
template <int... Is>
void foo()
{
([i = Is]{}(), ...);
}
clang++(主干)成功编译代码-std=c++17-
g++(trunk) 编译失败,出现以下错误:<source>: In function 'void foo()': <source>:4:11: error: parameter packs not expanded with '...': ([i = Is]{}(), ...); ^~ <source>:4:11: note: 'Is' <source>:4:16: error: operand of fold expression has no unexpanded parameter packs ([i = Is]{}(), ...); ~~~~~~~~~~^~
这是 g++ 错误,还是标准阻止将参数包扩展为 lambda-introducer 的一部分?
【问题讨论】:
标签: c++ lambda language-lawyer variadic-templates c++17