forked from OSchip/llvm-project
LWG issue #2188: Reverse iterator does not fully support targets that overload operator&. Also mark #2272 and #2299 as complete; libc++ already implements them.
llvm-svn: 202339
This commit is contained in:
parent
27a58bf770
commit
c204c130fa
|
@ -327,6 +327,7 @@ template <class C> auto crend(const C& c) -> decltype(std::rend(c)); //
|
|||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <__functional_base>
|
||||
#include <type_traits>
|
||||
#include <cstddef>
|
||||
#include <iosfwd>
|
||||
|
@ -549,7 +550,7 @@ public:
|
|||
: __t(__u.base()), current(__u.base()) {}
|
||||
_LIBCPP_INLINE_VISIBILITY _Iter base() const {return current;}
|
||||
_LIBCPP_INLINE_VISIBILITY reference operator*() const {__t = current; return *--__t;}
|
||||
_LIBCPP_INLINE_VISIBILITY pointer operator->() const {return &(operator*());}
|
||||
_LIBCPP_INLINE_VISIBILITY pointer operator->() const {return _VSTD::addressof(operator*());}
|
||||
_LIBCPP_INLINE_VISIBILITY reverse_iterator& operator++() {--current; return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY reverse_iterator operator++(int)
|
||||
{reverse_iterator __tmp(*this); --current; return __tmp;}
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
// http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#198
|
||||
|
||||
#include <iterator>
|
||||
#include <list>
|
||||
#include <cassert>
|
||||
|
||||
class A
|
||||
|
@ -61,9 +62,47 @@ test(It i, typename std::iterator_traits<It>::value_type x)
|
|||
assert(r->get() == x.get());
|
||||
}
|
||||
|
||||
class B
|
||||
{
|
||||
int data_;
|
||||
public:
|
||||
B(int d=1) : data_(d) {}
|
||||
~B() {data_ = -1;}
|
||||
|
||||
int get() const {return data_;}
|
||||
|
||||
friend bool operator==(const B& x, const B& y)
|
||||
{return x.data_ == y.data_;}
|
||||
const B *operator&() const { return nullptr; }
|
||||
B *operator&() { return nullptr; }
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
test(weird_iterator<A>(A()), A());
|
||||
A a;
|
||||
test(&a+1, A());
|
||||
|
||||
{
|
||||
std::list<B> l;
|
||||
l.push_back(B(0));
|
||||
l.push_back(B(1));
|
||||
l.push_back(B(2));
|
||||
|
||||
{
|
||||
std::list<B>::const_iterator i = l.begin();
|
||||
assert ( i->get() == 0 ); ++i;
|
||||
assert ( i->get() == 1 ); ++i;
|
||||
assert ( i->get() == 2 ); ++i;
|
||||
assert ( i == l.end ());
|
||||
}
|
||||
|
||||
{
|
||||
std::list<B>::const_reverse_iterator ri = l.rbegin();
|
||||
assert ( ri->get() == 2 ); ++ri;
|
||||
assert ( ri->get() == 1 ); ++ri;
|
||||
assert ( ri->get() == 0 ); ++ri;
|
||||
assert ( ri == l.rend ());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -220,7 +220,7 @@
|
|||
<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2257">2257</a></td><td>Simplify container requirements with the new algorithms</td><td>Issaquah</td><td>Complete</td></tr>
|
||||
<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2268">2268</a></td><td>Setting a default argument in the declaration of a member function assign of std::basic_string</td><td>Issaquah</td><td></td></tr>
|
||||
<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2271">2271</a></td><td>regex_traits::lookup_classname specification unclear</td><td>Issaquah</td><td></td></tr>
|
||||
<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2272">2272</a></td><td>quoted should use char_traits::eq for character comparison</td><td>Issaquah</td><td></td></tr>
|
||||
<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2272">2272</a></td><td>quoted should use char_traits::eq for character comparison</td><td>Issaquah</td><td>Complete</td></tr>
|
||||
<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2278">2278</a></td><td>User-defined literals for Standard Library types</td><td>Issaquah</td><td>Complete</td></tr>
|
||||
<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2280">2280</a></td><td>begin / end for arrays should be constexpr and noexcept</td><td>Issaquah</td><td>Complete</td></tr>
|
||||
<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2285">2285</a></td><td>make_reverse_iterator</td><td>Issaquah</td><td></td></tr>
|
||||
|
@ -228,11 +228,11 @@
|
|||
<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2299">2299</a></td><td>Effects of inaccessible key_compare::is_transparent type are not clear</td><td>Issaquah</td><td>Complete</td></tr>
|
||||
|
||||
<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#1450">1450</a></td><td>Contradiction in regex_constants</td><td>Issaquah</td><td></td></tr>
|
||||
<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2003">2003</a></td><td>String exception inconsistency in erase.</td><td>Issaquah</td><td></td></tr>
|
||||
<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2003">2003</a></td><td>String exception inconsistency in erase.</td><td>Issaquah</td><td>Complete</td></tr>
|
||||
<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2112">2112</a></td><td>User-defined classes that cannot be derived from</td><td>Issaquah</td><td></td></tr>
|
||||
<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2132">2132</a></td><td>std::function ambiguity</td><td>Issaquah</td><td></td></tr>
|
||||
<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2182">2182</a></td><td>Container::[const_]reference types are misleadingly specified</td><td>Issaquah</td><td></td></tr>
|
||||
<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2188">2188</a></td><td>Reverse iterator does not fully support targets that overload operator&</td><td>Issaquah</td><td></td></tr>
|
||||
<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2188">2188</a></td><td>Reverse iterator does not fully support targets that overload operator&</td><td>Issaquah</td><td>Complete</td></tr>
|
||||
<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2193">2193</a></td><td>Default constructors for standard library containers are explicit</td><td>Issaquah</td><td></td></tr>
|
||||
<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2205">2205</a></td><td>Problematic postconditions of regex_match and regex_search</td><td>Issaquah</td><td></td></tr>
|
||||
<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2213">2213</a></td><td>Return value of std::regex_replace</td><td>Issaquah</td><td></td></tr>
|
||||
|
|
Loading…
Reference in New Issue