1800259c9SMarshall Clow //===----------------------------------------------------------------------===// 2800259c9SMarshall Clow // 357b08b09SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 457b08b09SChandler Carruth // See https://llvm.org/LICENSE.txt for license information. 557b08b09SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6800259c9SMarshall Clow // 7800259c9SMarshall Clow //===----------------------------------------------------------------------===// 831cbe0f2SLouis Dionne // UNSUPPORTED: c++03, c++11, c++14, c++17 9800259c9SMarshall Clow 10800259c9SMarshall Clow // <string> 11800259c9SMarshall Clow 12425620ccSNikolas Klauser // constexpr bool starts_with(charT x) const noexcept; 13800259c9SMarshall Clow 14800259c9SMarshall Clow #include <string> 15800259c9SMarshall Clow #include <cassert> 16800259c9SMarshall Clow 17800259c9SMarshall Clow #include "test_macros.h" 18800259c9SMarshall Clow 19*6e1dcc93SLouis Dionne template <class S> test_string()20*6e1dcc93SLouis Dionneconstexpr void test_string() { 21800259c9SMarshall Clow S s1{}; 22800259c9SMarshall Clow S s2{"abcde", 5}; 23800259c9SMarshall Clow 24800259c9SMarshall Clow ASSERT_NOEXCEPT(s1.starts_with('e')); 25800259c9SMarshall Clow 26800259c9SMarshall Clow assert(!s1.starts_with('a')); 27800259c9SMarshall Clow assert(!s1.starts_with('x')); 28800259c9SMarshall Clow assert(s2.starts_with('a')); 29800259c9SMarshall Clow assert(!s2.starts_with('x')); 30800259c9SMarshall Clow } 312df59c50SJF Bastien test()32*6e1dcc93SLouis Dionneconstexpr bool test() { 33*6e1dcc93SLouis Dionne test_string<std::string>(); 34*6e1dcc93SLouis Dionne 35c515b652SNikolas Klauser return true; 36c515b652SNikolas Klauser } 37c515b652SNikolas Klauser main(int,char **)38a40bada9SBrendan Emeryint main(int, char**) { 39c515b652SNikolas Klauser test(); 40425620ccSNikolas Klauser static_assert(test()); 41c515b652SNikolas Klauser 422df59c50SJF Bastien return 0; 43800259c9SMarshall Clow } 44