<html>
<head>
<base href="https://llvm.org/bugs/" />
</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 --- - variadic using in variadic struct evaluating bad in struct context but not outside"
href="https://llvm.org/bugs/show_bug.cgi?id=22942">22942</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>variadic using in variadic struct evaluating bad in struct context but not outside
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>3.6
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</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>Frontend
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>bloerwald@googlemail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>check<int, int>::u is supposed to be seq<0, 1>, but is seq<0> in context of
check, while it is seq<0, 1> when used outside of check.
#include <type_traits>
template<std::size_t... I> struct seq {
using next = seq<I..., sizeof... (I)>;
};
template<std::size_t N> struct iota {
using type = typename iota<N - 1>::type::next;
};
template<> struct iota<0ul> {
using type = seq<>;
};
template<typename... T> struct seq_for_t {
using type = typename iota<sizeof... (T)>::type;
};
template<typename... T> using seq_for = typename seq_for_t<T...>::type;
template<typename... T> using seq_for_u = typename iota<sizeof... (T)>::type;
template<typename... T> struct check {
using n = seq_for <T...>;
using u = seq_for_u<T...>;
using expected = seq<0, 1>;
static_assert (std::is_same<n, expected>::value, "");
static_assert (std::is_same<u, expected>::value, ""); /// <<< failing
};
using c = check<int, int>;
static_assert (std::is_same<c::n, c::expected>::value, "");
static_assert (std::is_same<c::u, c::expected>::value, ""); /// <<< NOT failing
$ clang++ -Wno-c++98-compat -Weverything --std=c++11 -c variadic_in_using.cpp
variadic_in_using.cpp:28:3: error: static_assert failed ""
static_assert (std::is_same<u, expected>::value, "");
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
$ clang++ -v
clang version 3.6.0 (tags/RELEASE_360/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
Found candidate GCC installation:
/soft/gcc/4.9.2/lib/gcc/x86_64-unknown-linux-gnu/4.9.2
Selected GCC installation:
/soft/gcc/4.9.2/lib/gcc/x86_64-unknown-linux-gnu/4.9.2
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Selected multilib: .;@m64</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>