diff options
Diffstat (limited to 'test/std/experimental/string.view/string.view.access/at.pass.cpp')
-rw-r--r-- | test/std/experimental/string.view/string.view.access/at.pass.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/test/std/experimental/string.view/string.view.access/at.pass.cpp b/test/std/experimental/string.view/string.view.access/at.pass.cpp index 46804d4df3af..7ceaf5ab3d9f 100644 --- a/test/std/experimental/string.view/string.view.access/at.pass.cpp +++ b/test/std/experimental/string.view/string.view.access/at.pass.cpp @@ -10,7 +10,7 @@ // NOTE: Older versions of clang have a bug where they fail to evalute // string_view::at as a constant expression. // XFAIL: clang-3.4, clang-3.3 -// XFAIL: libcpp-no-exceptions + // <string_view> @@ -20,6 +20,8 @@ #include <stdexcept> #include <cassert> +#include "test_macros.h" + template <typename CharT> void test ( const CharT *s, size_t len ) { std::experimental::basic_string_view<CharT> sv ( s, len ); @@ -27,12 +29,14 @@ void test ( const CharT *s, size_t len ) { for ( size_t i = 0; i < len; ++i ) { assert ( sv.at(i) == s[i] ); assert ( &sv.at(i) == s + i ); - } + } +#ifndef TEST_HAS_NO_EXCEPTIONS try { sv.at(len); } catch ( const std::out_of_range & ) { return ; } assert ( false ); - } - +#endif +} + int main () { test ( "ABCDE", 5 ); test ( "a", 1 ); @@ -40,7 +44,7 @@ int main () { test ( L"ABCDE", 5 ); test ( L"a", 1 ); -#if __cplusplus >= 201103L +#if TEST_STD_VER >= 11 test ( u"ABCDE", 5 ); test ( u"a", 1 ); @@ -48,7 +52,7 @@ int main () { test ( U"a", 1 ); #endif -#if __cplusplus >= 201103L +#if TEST_STD_VER >= 11 { constexpr std::experimental::basic_string_view<char> sv ( "ABC", 2 ); static_assert ( sv.length() == 2, "" ); |