[LLVMbugs] [Bug 16519] New: bogus "non-type template argument specializes a template parameter with dependent type" for in-class partial specialization
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Mon Jul 1 17:18:33 PDT 2013
http://llvm.org/bugs/show_bug.cgi?id=16519
Bug ID: 16519
Summary: bogus "non-type template argument specializes a
template parameter with dependent type" for in-class
partial specialization
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++
Assignee: unassignedclangbugs at nondot.org
Reporter: richard-llvm at metafoo.co.uk
CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
Classification: Unclassified
Clang rejects this:
template<typename T, T...N> struct integer_sequence { typedef T value_type; };
template<typename T> struct __make_integer_sequence;
template<typename T, T N> using make_integer_sequence = typename
__make_integer_sequence<T>::template make<N, N % 2>::type;
template<typename T, typename T::value_type ...Extra> struct
__make_integer_sequence_impl;
template<typename T, T ...N, T ...Extra> struct
__make_integer_sequence_impl<integer_sequence<T, N...>, Extra...> {
typedef integer_sequence<T, N..., sizeof...(N) + N..., Extra...> type;
};
template<typename T> struct __make_integer_sequence {
template<T N, T Parity, typename = void> struct make;
template<typename Dummy> struct make<0, 0, Dummy> { typedef
integer_sequence<T> type; };
template<typename Dummy> struct make<1, 1, Dummy> { typedef
integer_sequence<T, 0> type; };
template<T N, typename Dummy> struct make<N, 0, Dummy> :
__make_integer_sequence_impl<make_integer_sequence<T, N/2>> {};
template<T N, typename Dummy> struct make<N, 1, Dummy> :
__make_integer_sequence_impl<make_integer_sequence<T, N/2>, N> {};
};
using X = make_integer_sequence<int, 5>;
... saying ...
<stdin>:13:40: error: non-type template argument specializes a template
parameter with dependent type 'T'
template<typename Dummy> struct make<0, 0, Dummy> { typedef
integer_sequence<T> type; };
^
<stdin>:12:14: note: template parameter is declared here
template<T N, T Parity, typename = void> struct make;
^
This is incorrect: the template parameter does not have a dependent type in a
specialization of __make_integer_sequence, therefore the template has valid
specializations, therefore we are not permitted to reject it.
--
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/20130702/47bfb1cc/attachment.html>
More information about the llvm-bugs
mailing list