[LLVMbugs] [Bug 22942] New: variadic using in variadic struct evaluating bad in struct context but not outside
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Tue Mar 17 10:31:36 PDT 2015
https://llvm.org/bugs/show_bug.cgi?id=22942
Bug ID: 22942
Summary: variadic using in variadic struct evaluating bad in
struct context but not outside
Product: clang
Version: 3.6
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Frontend
Assignee: unassignedclangbugs at nondot.org
Reporter: bloerwald at googlemail.com
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
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
--
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/20150317/2349e669/attachment.html>
More information about the llvm-bugs
mailing list