[llvm-bugs] [Bug 44857] New: -Wctad-maybe-unsupported fires on move_iterator
via llvm-bugs
llvm-bugs at lists.llvm.org
Sun Feb 9 10:38:32 PST 2020
https://bugs.llvm.org/show_bug.cgi?id=44857
Bug ID: 44857
Summary: -Wctad-maybe-unsupported fires on move_iterator
Product: libc++
Version: unspecified
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: All Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: arthur.j.odwyer at gmail.com
CC: llvm-bugs at lists.llvm.org, mclow.lists at gmail.com
// https://godbolt.org/z/acPvrB
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.)
--
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/20200209/f1ecc5bd/attachment.html>
More information about the llvm-bugs
mailing list