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

            Bug ID: 66693
           Summary: [C++17] std::tuple_size fails with const std::array
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ldionne.2 at gmail dot com
  Target Milestone: ---

The following code fails on GCC trunk:

------------------------------------------------------------------------------
#include <array>

int main() {
    std::tuple_size<std::array<int, 10> const>::value;
}
------------------------------------------------------------------------------

The failure is

    error: implicit instantiation of undefined template 
        'std::tuple_size<const std::array<int, 10> >'
    std::tuple_size<std::array<int, 10> const>::value;
         ^
    note: template is declared here
    class tuple_size;
          ^

This is because the specializations of tuple_size for const and volatile
types is in the <tuple> header, but they ought to be available when including
<utility> and <array> in C++17.

Strictly speaking, this isn't a bug since C++14 does not require <utility> and
<array> to have these specializations AFAIK. However, it would be a trivial
fix.

Reply via email to