https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86356
Bug ID: 86356
Summary: "invalid use of pack expansion" with fold expressions
Product: gcc
Version: 8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: pdimov at gmail dot com
Target Milestone: ---
The code
```
#include <type_traits>
template<bool B> using mp_bool = std::integral_constant<bool, B>;
template<class... T> using mp_all = mp_bool<(static_cast<bool>(T::value) &&
...)>;
template<class... T> using mp_any = mp_bool<(static_cast<bool>(T::value) ||
...)>;
template<bool is_trivially_destructible, bool is_single_buffered, class... T>
struct variant_base_impl {};
template<class... T> using variant_base =
variant_base_impl<mp_all<std::is_trivially_destructible<T>...>::value,
mp_any<mp_all<std::is_nothrow_move_constructible<T>...>,
std::is_nothrow_default_constructible<T>...>::value, T...>;
int main()
{
variant_base<void, int, float>();
}
```
yields with g++ 7.3 (and 8.1)
```
testbed2017.cpp: In substitution of 'template<class ... T> using variant_base =
variant_base_impl<std::integral_constant<bool,
(static_cast<bool>(std::is_trivially_destructible<T>::value) && ...)>::value,
std::integral_constant<bool, (static_cast<bool>(std::integral_constant<bool,
(static_cast<bool>(std::is_nothrow_move_constructible<T>::value) &&
...)>::value) ||
static_cast<bool>(std::is_nothrow_default_constructible<T>::value)
...)>::value, T ...> [with T = {void, int, float}]':
testbed2017.cpp:13:31: required from here
testbed2017.cpp:6:82: error: invalid use of pack expansion expression
template<class... T> using mp_any = mp_bool<(static_cast<bool>(T::value) ||
...)>;
^
```
clang++ accepts.