Skip to content

Commit 77d76b7

Browse files
EricWFtstellar
authored andcommitted
[libc++] Fix recursive instantiation in std::array.
The use of the `&& ...` fold expression in std::array's deduction guides recursively builds a set of binary operator expressions of depth N where `N` is the number of elements in the initializer. This is problematic because arrays may be large, and instantiation depth is limited. This patch addresses the issue by flattening the SFINAE using the existing `__all` type trait. (cherry picked from commit c6eb584)
1 parent 76ceebb commit 77d76b7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

libcxx/include/array

+1-1
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ struct _LIBCPP_TEMPLATE_VIS array<_Tp, 0>
359359

360360
#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
361361
template<class _Tp, class... _Args,
362-
class = typename enable_if<(is_same_v<_Tp, _Args> && ...), void>::type
362+
class = _EnableIf<__all<_IsSame<_Tp, _Args>::value...>::value>
363363
>
364364
array(_Tp, _Args...)
365365
-> array<_Tp, 1 + sizeof...(_Args)>;

0 commit comments

Comments
 (0)