<html>
    <head>
      <base href="http://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 --- - inheriting constructor leads to erroneous SFINAE error"
   href="http://llvm.org/bugs/show_bug.cgi?id=22079">22079</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>inheriting constructor leads to erroneous SFINAE error
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows NT
          </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>C++11
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>eniebler@boost.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The following code fails to compile. I believe it should, and does with gcc.

#include <type_traits>
#include <utility>

template<typename T>
using decay_t = typename std::decay<T>::type;

template <class _T1, class _T2>
struct pair
{
    typedef _T1 first_type;
    typedef _T2 second_type;

    _T1 first;
    _T2 second;

    // pair(const pair&) = default;
    // pair(pair&&) = default;

    constexpr pair() : first(), second() {}

    pair(const _T1& __x, const _T2& __y)
        : first(__x), second(__y) {}

    template<class _U1, class _U2>
        pair(const pair<_U1, _U2>& __p
                 ,typename std::enable_if<std::is_convertible<const _U1&,
_T1>::value &&
                                    std::is_convertible<const _U2&,
_T2>::value>::type* = 0
                                      )
            : first(__p.first), second(__p.second) {}

};

template<typename F, typename S>
struct pair_ref
  : ::pair<F, S>
{
    using ::pair<F, S>::pair;
    pair_ref(::pair<decay_t<F>, decay_t<S>> & val)
       : ::pair<F, S>{val.first, val.second}
    {}
    using ::pair<F, S>::operator=;
};

int main()
{
    static_assert(std::is_convertible<::pair<int,int>&,
::pair_ref<int&,int&>>::value, "");
}



The error I see is:


/cygdrive/c/Users/eric/Code/range-v3/libs/range/v3/scratch/range.cpp:26:43:
error: no type named 'type' in
      'std::enable_if<false, void>'; 'enable_if' cannot be used to disable this
declaration
                 ,typename std::enable_if<std::is_convertible<const _U1&,
_T1>::value &&
                                         
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/cygdrive/c/Users/eric/Code/range-v3/libs/range/v3/scratch/range.cpp:37:25:
note: in instantiation of member function
      'pair<int &, int &>::pair' requested here
    using ::pair<F, S>::pair;
                        ^


There is no reason I can see why SFINAE should not be able to disable the
inherited constructor. If the constructor in question is copied into the
derived class (and renamed appropriately), the code compiles just fine.</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>