forked from OSchip/llvm-project
Mark LWG#2853 as complete. No code changes required, but added a couple of extra tests
llvm-svn: 300449
This commit is contained in:
parent
44fea6b864
commit
f0d59405f0
|
@ -18,6 +18,19 @@
|
|||
#include "min_allocator.h"
|
||||
#include "asan_testing.h"
|
||||
|
||||
struct Throws {
|
||||
Throws() : v_(0) {}
|
||||
Throws(int v) : v_(v) {}
|
||||
Throws(const Throws &rhs) : v_(rhs.v_) { if (sThrows) throw 1; }
|
||||
Throws( Throws &&rhs) : v_(rhs.v_) { if (sThrows) throw 1; }
|
||||
Throws& operator=(const Throws &rhs) { v_ = rhs.v_; return *this; }
|
||||
Throws& operator=( Throws &&rhs) { v_ = rhs.v_; return *this; }
|
||||
int v_;
|
||||
static bool sThrows;
|
||||
};
|
||||
|
||||
bool Throws::sThrows = false;
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
|
@ -72,4 +85,15 @@ int main()
|
|||
assert(is_contiguous_container_asan_correct(l1));
|
||||
}
|
||||
#endif
|
||||
// Test for LWG2853:
|
||||
// Throws: Nothing unless an exception is thrown by the assignment operator or move assignment operator of T.
|
||||
{
|
||||
Throws arr[] = {1, 2, 3};
|
||||
std::vector<Throws> v(arr, arr+3);
|
||||
Throws::sThrows = true;
|
||||
v.erase(v.begin());
|
||||
v.erase(--v.end());
|
||||
v.erase(v.begin());
|
||||
assert(v.size() == 0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,19 @@
|
|||
#include "min_allocator.h"
|
||||
#include "asan_testing.h"
|
||||
|
||||
struct Throws {
|
||||
Throws() : v_(0) {}
|
||||
Throws(int v) : v_(v) {}
|
||||
Throws(const Throws &rhs) : v_(rhs.v_) { if (sThrows) throw 1; }
|
||||
Throws( Throws &&rhs) : v_(rhs.v_) { if (sThrows) throw 1; }
|
||||
Throws& operator=(const Throws &rhs) { v_ = rhs.v_; return *this; }
|
||||
Throws& operator=( Throws &&rhs) { v_ = rhs.v_; return *this; }
|
||||
int v_;
|
||||
static bool sThrows;
|
||||
};
|
||||
|
||||
bool Throws::sThrows = false;
|
||||
|
||||
int main()
|
||||
{
|
||||
int a1[] = {1, 2, 3};
|
||||
|
@ -125,4 +138,15 @@ int main()
|
|||
assert(is_contiguous_container_asan_correct(outer[1]));
|
||||
}
|
||||
#endif
|
||||
// Test for LWG2853:
|
||||
// Throws: Nothing unless an exception is thrown by the assignment operator or move assignment operator of T.
|
||||
{
|
||||
Throws arr[] = {1, 2, 3};
|
||||
std::vector<Throws> v(arr, arr+3);
|
||||
Throws::sThrows = true;
|
||||
v.erase(v.begin(), --v.end());
|
||||
assert(v.size() == 1);
|
||||
v.erase(v.begin(), v.end());
|
||||
assert(v.size() == 0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -462,7 +462,7 @@
|
|||
<tr><td><a href="http://wg21.link/LWG2838">2838</a></td><td>is_literal_type specification needs a little cleanup</td><td>Kona</td><td>Complete</td></tr>
|
||||
<tr><td><a href="http://wg21.link/LWG2842">2842</a></td><td>in_place_t check for optional::optional(U&&) should decay U</td><td>Kona</td><td>Complete</td></tr>
|
||||
<tr><td><a href="http://wg21.link/LWG2850">2850</a></td><td>std::function move constructor does unnecessary work</td><td>Kona</td><td></td></tr>
|
||||
<tr><td><a href="http://wg21.link/LWG2853">2853</a></td><td>Possible inconsistency in specification of erase in [vector.modifiers]</td><td>Kona</td><td></td></tr>
|
||||
<tr><td><a href="http://wg21.link/LWG2853">2853</a></td><td>Possible inconsistency in specification of erase in [vector.modifiers]</td><td>Kona</td><td>Complete</td></tr>
|
||||
<tr><td><a href="http://wg21.link/LWG2855">2855</a></td><td>std::throw_with_nested("string_literal")</td><td>Kona</td><td>Complete</td></tr>
|
||||
<tr><td><a href="http://wg21.link/LWG2857">2857</a></td><td>{variant,optional,any}::emplace should return the constructed value</td><td>Kona</td><td>Complete</td></tr>
|
||||
<tr><td><a href="http://wg21.link/LWG2861">2861</a></td><td>basic_string should require that charT match traits::char_type</td><td>Kona</td><td>Complete</td></tr>
|
||||
|
@ -489,7 +489,7 @@
|
|||
<!-- <tr><td></td><td></td><td></td><td></td></tr> -->
|
||||
</table>
|
||||
|
||||
<p>Last Updated: 13-Apr-2017</p>
|
||||
<p>Last Updated: 17-Apr-2017</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Loading…
Reference in New Issue