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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to