Skip to content

Commit

Permalink
Add test to ensure subscripting is noexcept
Browse files Browse the repository at this point in the history
Refs: gh-115
Signed-off-by: Matthias Kretz <kretz@kde.org>
  • Loading branch information
mattkretz committed Mar 23, 2016
1 parent 494a255 commit 25ae212
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/scalaraccess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,3 +243,22 @@ TEST_TYPES(V, operators, (ALL_VECTORS, SIMD_ARRAY_LIST))
VERIFY(!test_band_assign(*y, 13, 9));
VERIFY(!test_bxor_assign(*y, 1, 8));
}

TEST_TYPES(V, ensure_noexcept, (ALL_VECTORS, SIMD_ARRAY_LIST))
{
V a{};
const V &b = a;
EntryType<V> x = a[0]; if (x == x) {}
VERIFY(noexcept(a[0]));
VERIFY(noexcept(x = b[0]));
VERIFY(noexcept(x = a[0]));
VERIFY(noexcept(a[0] = 1));
VERIFY(noexcept(a[0] += 1));
VERIFY(noexcept(a[0] -= 1));
VERIFY(noexcept(a[0] *= 1));
VERIFY(noexcept(a[0] /= 1));
VERIFY(noexcept(++a[0]));
VERIFY(noexcept(--a[0]));
VERIFY(noexcept(a[0]++));
VERIFY(noexcept(a[0]--));
}

0 comments on commit 25ae212

Please sign in to comment.