Added a noexcept test

llvm-svn: 265674
This commit is contained in:
Marshall Clow 2016-04-07 14:24:16 +00:00
parent 56004c577a
commit f90ec0e82e
1 changed files with 6 additions and 0 deletions

View File

@ -17,12 +17,18 @@
int main() int main()
{ {
bool a[] = {false, true, false, true}; bool a[] = {false, true, false, true};
bool* an = a + sizeof(a)/sizeof(a[0]); bool* an = a + sizeof(a)/sizeof(a[0]);
std::vector<bool> v(a, an); std::vector<bool> v(a, an);
std::vector<bool>::reference r1 = v[0]; std::vector<bool>::reference r1 = v[0];
std::vector<bool>::reference r2 = v[3]; std::vector<bool>::reference r2 = v[3];
#if __has_feature(cxx_noexcept)
static_assert((noexcept(v.swap(r1,r2))), "");
#endif
assert(!r1); assert(!r1);
assert( r2); assert( r2);
v.swap(r1, r2); v.swap(r1, r2);