[LLVMbugs] [Bug 22328] New: std::index_sequence_for<T...>::size() returns always 1

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Jan 25 02:29:47 PST 2015


http://llvm.org/bugs/show_bug.cgi?id=22328

            Bug ID: 22328
           Summary: std::index_sequence_for<T...>::size() returns always 1
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++14
          Assignee: unassignedclangbugs at nondot.org
          Reporter: kikairoya+llvm at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

http://melpon.org/wandbox/permlink/QuELiPyJatHx3buq

index_sequence_for<T...>::size() should return sizeof...(T) but always 1.
make_index_sequence<sizeof...(T)>::size() works fine.

===============

#include <utility>

template <typename ...Ts>
struct X {
  static constexpr std::size_t size1() {
    return std::index_sequence_for<Ts...>::size();
  }
  static constexpr std::size_t size2() {
    return std::make_index_sequence<sizeof...(Ts)>::size();
  }
};

#include <iostream>

int main() {
  const auto f = [](auto x) { std::cout << x.size1() << ',' << x.size2() <<
std::endl; };
  f(X<>());
  f(X<int>());
  f(X<int, long>());
  f(X<int, long, char>());
}



==============

1,0
1,1
1,2
1,3

==============

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150125/406835ab/attachment.html>


More information about the llvm-bugs mailing list