Case 1:
Consider the following pack expansion in lambda noexcept
specifier:
template <bool... B>
auto g() {
([]() noexcept(B) {}, ...);
}
Clang and MSVC accept this code, but GCC rejects with:
error: expansion pattern '<lambda>' contains no parameter packs
Is this a valid code? Which Compiler should I trust?
Case 2:
Consider the following pack expansion in lambda requires-clause
:
template <bool... B>
auto g() {
([](auto) requires(B) {}, ...);
}
In this case, Clang and MSVC still accept this code, and GCC rejects it with the same error message. Is this just the same bug?
Case 3:
Consider the following pack expansion in the lambda template list:
template <typename... Args>
void g(Args...) {
([]<Args>(){}, ...);
}
This time three compiler all reject with the same error message:
expansion pattern '<lambda>' contains no parameter packs
Is there a difference compared to case 1? Or is this a common bug?