<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - clang crashes on this code. already submitted to Apple"
   href="https://bugs.llvm.org/show_bug.cgi?id=33444">33444</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang crashes on this code. already submitted to Apple
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>4.0
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Macintosh
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>MacOS X
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>C++14
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>bayoubengal@mac.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>this code blows up clang due to having the indexes wrong on cTupleRange<>. it
causes a negative number to be passed std::make_index_sequence<>.   


template<typename tpTupleType, size_t tpOffsetIntoTypeList, typename
tpIndexSequenceType>
struct cTupleRange_
{
};

template<typename tpTupleType, size_t tpOffsetIntoTypeList, size_t...
tpIndexes>
struct cTupleRange_<tpTupleType, tpOffsetIntoTypeList,
std::index_sequence<tpIndexes...> >
{
   using tuple_type = tpTupleType;

   using type =  std::tuple< typename std::tuple_element< tpOffsetIntoTypeList
+ tpIndexes, tuple_type>::type... >;
};

template<typename tpTupleType, size_t tpStartIdx, size_t tpEndIdx>
struct cTupleRange
{
   using tuple_type = tpTupleType;

   static constexpr auto kOffset_value = tpStartIdx;
   using index_sequence_type = std::make_index_sequence<tpEndIdx - tpStartIdx>;

   int x = index_sequence_type{};



   using type = typename cTupleRange_<tuple_type, kOffset_value,
index_sequence_type>::type;

};


int main(int argc, const char * argv[])
{
   using x = std::tuple<std::unique_ptr<void, void(*)(void*)>, double,
std::string, float, long, short, char, std::string>;  //,
std::unique_ptr<void*, void(*)(void*)> >;


   using remainder_type = typename cTupleRange<x, 5, 3>::type;


   return 0;
}</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>