[Bug libstdc++/78830] std::prev accepts ForwardIterator-s

akrzemi1 at gmail dot com gcc-bugzilla@gcc.gnu.org
Fri Dec 16 14:02:00 GMT 2016


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78830

--- Comment #2 from Andrzej Krzemienski <akrzemi1 at gmail dot com> ---
Sorry, you are correct. As per [res.on.functions], passing types that do not
satisfy the requirements is a UB, and therefore a well formed program. GCC is
standard-compliant in this respect.

So, I have lost my strongest argument, but I still feel this check should not
be "opt-in". As a QOI matter, could a standard-allowed UB be implemented as a
compile-time failure?


More information about the Gcc-bugs mailing list