<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 when it cannot evaluate recursive template"
href="https://bugs.llvm.org/show_bug.cgi?id=43078">43078</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Clang crashes when it cannot evaluate recursive template
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>9.0
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>-New Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>z.zoelec2@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>Found this bug while working on libc++ so the example isn't great. It appears
Clang crashes when it cannot evaluate recursive template parameters. Setting
-ftemplate-depth=100 turns it into an error. Here is the (rather large) example
I have:
template<class _T1, class _T2>
struct __all_const_impl;
template<class..._T1Args, class... _T2Args>
struct __all_const_impl<__tuple_types<_T1Args...>, __tuple_types<_T2Args...>>
: true_type {};
template<template<class...> class _T1, class... _T1Args, class... _T2Args>
auto __all_const_fn(_T1<_T1Args...>, _T2Args...)
-> __all_const_impl<__tuple_types<_T1Args...>, __tuple_types<_T2Args...>>;
template<class _T1, class... _T2Args>
using __all_const = decltype(__all_const_fn(declval<_T1>(),
declval<_T2Args>()...));
template<class _Tuple,
class _Idxs = typename
__make_tuple_indices<tuple_size<_Tuple>::value>::type>
struct foo_impl;
template<class... _Bound, size_t... _Idxs>
struct foo_impl<__tuple_types<_Bound...>, __tuple_indices<_Idxs...>>
{
std::tuple<_Bound...> __bound;
template<class... _BoundArgs,
class = enable_if_t<__all_const<std::tuple<_Bound...>,
_BoundArgs...>::value>>
foo_impl(_BoundArgs&&... __bound) { }
};
template<class... _Args>
using Foo = foo_impl<__tuple_types<decay_t<_Args>...>>;
static_assert(is_move_constructible<decltype(Foo<int>(1))>::value);
Here is a link to wandbox: <a href="https://wandbox.org/permlink/dQwvJViWFJakPfPd">https://wandbox.org/permlink/dQwvJViWFJakPfPd</a></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>