1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8
9 // UNSUPPORTED: c++03, c++11
10
11 // UNSUPPORTED: no-wide-characters
12
13 // Check that __constexpr_* cwchar functions are actually constexpr
14
15 #include <cwchar>
16
17 static_assert(std::__constexpr_wcslen(L"Banane") == 6, "");
18 static_assert(std::__constexpr_wmemcmp(L"Banane", L"Banand", 6) == 1, "");
19 static_assert(std::__constexpr_wmemcmp(L"Banane", L"Banane", 6) == 0, "");
20 static_assert(std::__constexpr_wmemcmp(L"Banane", L"Bananf", 6) == -1, "");
21
test_constexpr_wmemchr()22 constexpr bool test_constexpr_wmemchr() {
23 const wchar_t str[] = L"Banane";
24 return std::__constexpr_wmemchr(str, 'n', 6) == str + 2;
25 }
26 static_assert(test_constexpr_wmemchr(), "");
27