[X86] matchPMADDWD/matchPMADDWD_2 - update to use m_ExtractElt matchers. NFC.
[llvm-project.git] / libcxx / test / std / strings / string.view / string.view.cons / implicit_deduction_guides.pass.cpp
blob53caed55064fa6600d03f9ad862d847e36a78065
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 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: c++03, c++11, c++14
11 // <string_view>
13 // Test that the constructors offered by std::basic_string_view are formulated
14 // so they're compatible with implicit deduction guides.
16 #include <string_view>
17 #include <cassert>
19 #include "test_macros.h"
20 #include "constexpr_char_traits.h"
22 // Overloads
23 // ---------------
24 // (1) basic_string_view() - NOT TESTED
25 // (2) basic_string_view(const basic_string_view&)
26 // (3) basic_string_view(const CharT*, size_type)
27 // (4) basic_string_view(const CharT*)
28 int main(int, char**) {
30 // Testing (1)
31 // Nothing to do. Cannot deduce without any arguments.
33 { // Testing (2)
34 const std::string_view sin("abc");
35 std::basic_string_view s(sin);
36 ASSERT_SAME_TYPE(decltype(s), std::string_view);
37 assert(s == "abc");
39 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
40 using WSV = std::basic_string_view<wchar_t, constexpr_char_traits<wchar_t>>;
41 const WSV win(L"abcdef");
42 std::basic_string_view w(win);
43 ASSERT_SAME_TYPE(decltype(w), WSV);
44 assert(w == L"abcdef");
45 #endif
47 { // Testing (3)
48 std::basic_string_view s("abc", 2);
49 ASSERT_SAME_TYPE(decltype(s), std::string_view);
50 assert(s == "ab");
52 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
53 std::basic_string_view w(L"abcdef", 4);
54 ASSERT_SAME_TYPE(decltype(w), std::wstring_view);
55 assert(w == L"abcd");
56 #endif
58 { // Testing (4)
59 std::basic_string_view s("abc");
60 ASSERT_SAME_TYPE(decltype(s), std::string_view);
61 assert(s == "abc");
63 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
64 std::basic_string_view w(L"abcdef");
65 ASSERT_SAME_TYPE(decltype(w), std::wstring_view);
66 assert(w == L"abcdef");
67 #endif
70 return 0;