https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86355

            Bug ID: 86355
           Summary: Internal compiler error with pack expansion and fold
                    expression
           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 following code

```
#include <type_traits>

template<bool B> using mp_bool = std::integral_constant<bool, B>;
using mp_true = mp_bool<true>;

template<class... T> using mp_all = mp_bool<(static_cast<bool>(T::value) &&
...)>;

template<class V, class... T> using check2 = mp_all<std::is_same<V, void>,
mp_all<std::is_copy_constructible<T>...,
mp_all<std::is_copy_assignable<T>...>>>;

static_assert( std::is_same<check2<void, int, float>, mp_true>::value );
```

with g++ 7.3 (and 8.1) yields

```
testbed2017.cpp: In substitution of 'template<class V, class ... T> using
check2
 = mp_all<std::is_same<V, void>, std::integral_constant<bool,
(static_cast<bool>(T::value)  && ...)> > [with V = void; T = {int, float}]':
testbed2017.cpp:10:52:   required from here
testbed2017.cpp:8:156: internal compiler error: Segmentation fault
 template<class V, class... T> using check2 = mp_all<std::is_same<V, void>,
mp_all<std::is_copy_constructible<T>...,
mp_all<std::is_copy_assignable<T>...>>>;

                                                                            ^
```

clang++ accepts it.

Reply via email to