[llvm-bugs] [Bug 33444] New: clang crashes on this code. already submitted to Apple

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jun 13 16:19:44 PDT 2017


https://bugs.llvm.org/show_bug.cgi?id=33444

            Bug ID: 33444
           Summary: clang crashes on this code. already submitted to Apple
           Product: clang
           Version: 4.0
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++14
          Assignee: unassignedclangbugs at nondot.org
          Reporter: bayoubengal at mac.com
                CC: llvm-bugs at lists.llvm.org

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;
}

-- 
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/20170613/c297d44c/attachment-0001.html>


More information about the llvm-bugs mailing list