Skip to content

<array>: CTAD and element count limit #5665

Description

@tiagomacarios

The pseudo code below when compiled with clang errors out.

static constexpr const std::array arr = { 49000 items };

error:


<compiler>\lib\native\include\type_traits:40:27: error: recursive template instantiation exceeded maximum depth of 1024 [clang-diagnostic-error]
   40 |     using type = typename _Conjunction<static_cast<bool>(_Next::value), _Next, _Rest...>::type;
      |                           ^
<compiler>\lib\native\include\type_traits:40:27: note: in instantiation of template class 'std::_Conjunction<true, std::is_same<unsigned int, unsigned int>, ..., std::is_same<unsigned int, unsigned int>>' requested here
  584 |         conjunction_v<is_same<_First, _Rest>...>, "N4950 [array.cons]/2: Mandates: (is_same_v<T, U> && ...) is true.");
      |         ^
<compiler>\lib\native\include\array:589:43: note: in instantiation of template class 'std::_Enforce_same<unsigned int, ..., unsigned int>' requested here
  589 | array(_First, _Rest...) -> array<typename _Enforce_same<_First, _Rest...>::type, 1 + sizeof...(_Rest)>;
      |                                           ^
<file>:11:35: note: while substituting deduced template arguments into function template '<deduction guide for array>' [with _First = unsigned int, _Rest = <unsigned int, ..., unsigned int>]
   11 | static constexpr const std::array arr = {
      |  

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementSomething can be improved

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions