Remove bad "take" impl that causes g++-11 crash.

For some reason, having `take<n, numeric_list<T>>` for `n > 0` causes
g++-11 to ICE with
```
sorry, unimplemented: unexpected AST of kind nontype_argument_pack
```
It does work with other versions of gcc, and with clang.
I filed a GCC bug
[here](https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102999).

Technically we should never actually run into this case, since you
can't take n > 0 elements from an empty list.  Commenting it out
allows our Eigen tests to pass.
This commit is contained in:
Antonio Sanchez 2021-10-29 09:28:11 -07:00 committed by Rasmus Munk Larsen
parent f6c8cc0e99
commit 8f8c2ba2fe

View File

@ -81,7 +81,8 @@ template<typename a, typename... as> struct take<0, type_list<a, as...>>
template<> struct take<0, type_list<>> { typedef type_list<> type; };
template<typename T, int n, T a, T... as> struct take<n, numeric_list<T, a, as...>> : concat<numeric_list<T, a>, typename take<n-1, numeric_list<T, as...>>::type> {};
template<typename T, int n> struct take<n, numeric_list<T>> { typedef numeric_list<T> type; };
// XXX The following breaks in gcc-11, and is invalid anyways.
// template<typename T, int n> struct take<n, numeric_list<T>> { typedef numeric_list<T> type; };
template<typename T, T a, T... as> struct take<0, numeric_list<T, a, as...>> { typedef numeric_list<T> type; };
template<typename T> struct take<0, numeric_list<T>> { typedef numeric_list<T> type; };