[LLVM][NVPTX] Add support for griddepcontrol instruction (#123511)
[llvm-project.git] / libcxx / test / std / strings / string.view / char.bad.verify.cpp
blobdf9173638815053596693a6b7e6162114fd19c01
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: !stdlib=libc++ && (c++03 || c++11 || c++14)
11 // XFAIL: FROZEN-CXX03-HEADERS-FIXME
13 // <string_view>
14 // ... manipulating sequences of any non-array trivial standard-layout types.
16 #include <string>
17 #include "../basic.string/test_traits.h"
19 struct NotTrivial {
20 NotTrivial() : value(3) {}
21 int value;
24 struct NotStandardLayout {
25 public:
26 NotStandardLayout() : one(1), two(2) {}
27 int sum() const { return one + two; } // silences "unused field 'two' warning"
28 int one;
30 private:
31 int two;
34 int main(int, char**) {
36 // array
37 typedef char C[3];
38 static_assert(std::is_array<C>::value, "");
39 std::basic_string_view<C, test_traits<C> > sv;
40 // expected-error-re@string_view:* {{static assertion failed{{.*}}Character type of basic_string_view must not be an array}}
44 // not trivial
45 static_assert(!std::is_trivial<NotTrivial>::value, "");
46 std::basic_string_view<NotTrivial, test_traits<NotTrivial> > sv;
47 // expected-error-re@string_view:* {{static assertion failed{{.*}}Character type of basic_string_view must be trivial}}
51 // not standard layout
52 static_assert(!std::is_standard_layout<NotStandardLayout>::value, "");
53 std::basic_string_view<NotStandardLayout, test_traits<NotStandardLayout> > sv;
54 // expected-error-re@string_view:* {{static assertion failed{{.*}}Character type of basic_string_view must be standard-layout}}
57 return 0;