<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - iterator_traits isn't SFINAE-friendly enough"
   href="https://bugs.llvm.org/show_bug.cgi?id=39619">39619</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>iterator_traits isn't SFINAE-friendly enough
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libc++
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>7.0
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>All Bugs
          </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>llvm-bugs@lists.llvm.org, mclow.lists@gmail.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The following program fails to compile:

#include <iterator>
struct not_an_iterator {
    using iterator_category = std::input_iterator_tag;
};
std::iterator_traits<not_an_iterator> x;


The error is as follows:


In file included from <source>:1:
/opt/compiler-explorer/clang-trunk-20181110/bin/../include/c++/v1/iterator:456:29:
error: no type named 'difference_type' in 'not_an_iterator'
    typedef typename _Iter::difference_type   difference_type;
            ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
/opt/compiler-explorer/clang-trunk-20181110/bin/../include/c++/v1/iterator:467:8:
note: in instantiation of template class
'std::__1::__iterator_traits_impl<not_an_iterator, true>' requested here
    :  __iterator_traits_impl
       ^
/opt/compiler-explorer/clang-trunk-20181110/bin/../include/c++/v1/iterator:482:7:
note: in instantiation of template class
'std::__1::__iterator_traits<not_an_iterator, true>' requested here
    : __iterator_traits<_Iter, __has_iterator_category<_Iter>::value> {};
      ^
<source>:5:39: note: in instantiation of template class
'std::__1::iterator_traits<not_an_iterator>' requested here
std::iterator_traits<not_an_iterator> x;
                                      ^
In file included from <source>:1:
/opt/compiler-explorer/clang-trunk-20181110/bin/../include/c++/v1/iterator:457:29:
error: no type named 'value_type' in 'not_an_iterator'
    typedef typename _Iter::value_type        value_type;
            ~~~~~~~~~~~~~~~~^~~~~~~~~~
/opt/compiler-explorer/clang-trunk-20181110/bin/../include/c++/v1/iterator:458:29:
error: no type named 'pointer' in 'not_an_iterator'
    typedef typename _Iter::pointer           pointer;
            ~~~~~~~~~~~~~~~~^~~~~~~
/opt/compiler-explorer/clang-trunk-20181110/bin/../include/c++/v1/iterator:459:29:
error: no type named 'reference' in 'not_an_iterator'
    typedef typename _Iter::reference         reference;
            ~~~~~~~~~~~~~~~~^~~~~~~~~
4 errors generated.



The primary iterator_traits template merely tests for the presence of a nested
::iterator_concept typedef. It is required by the standard to test for the
presence of all the iterator typedefs: ::value_type, ::difference_type,
::reference, and ::pointer.</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>