<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 - -Wctad-maybe-unsupported fires on move_iterator"
   href="https://bugs.llvm.org/show_bug.cgi?id=44857">44857</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>-Wctad-maybe-unsupported fires on move_iterator
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>unspecified
          </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>arthur.j.odwyer@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, mclow.lists@gmail.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>// <a href="https://godbolt.org/z/acPvrB">https://godbolt.org/z/acPvrB</a>

When manually enabling `-Wctad-maybe-unsupported` on the command line:

<source>:10:17: warning: 'move_iterator' may not intend to support class
template argument deduction [-Wctad-maybe-unsupported]
    std::sample(std::move_iterator(in.begin()), std::move_iterator(in.end()),
std::back_inserter(out),
                ^
/opt/compiler-explorer/clang-trunk-20200209/bin/../include/c++/v1/iterator:1187:28:
note: add a deduction guide to suppress this warning
class _LIBCPP_TEMPLATE_VIS move_iterator
                           ^

My impression is that `move_iterator` is one of those classes that's pretty
much always safe to use with CTAD. I mean it's even safer than `vector`, unless
I'm missing something, because an "vector of vector" is a different beast from
a regular "vector", but a "move iterator of move iterator" is almost
indistinguishable from a "move iterator."

So it seems backwards that Clang would issue no warning on `vector{v}` but
issue a bogus warning on `move_iterator(it)`.

(I would still like to see a general-purpose `-Wctad` analogous to `-Wvla`, but
if `-Wctad-maybe-unsupported` is going to exist, then it shouldn't warn on
`move_iterator`. I also would not object to just removing
`-Wctad-maybe-unsupported`; I'm not aware that it warns on anything I care
about, and vice versa it fails to warn on all the STL things I do care about,
such as `vector` and `optional` and `pair`. I also noticed today that it
doesn't warn on `uniform_int_distribution`, and I'm not sure yet how I feel
about that.)</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>