OpenMP: Fix typo in atomic directive error message
[gcc.git] / libstdc++-v3 / testsuite / 23_containers / vector / nodiscard.cc
blob3b5480d16d479c98d69cdf5085ea0c19e50db8e7
1 // { dg-do compile { target c++17 } }
3 #include <vector>
5 void
6 test_observers(std::vector<int> v)
8 v.size(); // { dg-warning "ignoring return value" }
9 v.capacity(); // { dg-warning "ignoring return value" }
10 v.empty(); // { dg-warning "ignoring return value" }
13 void
14 test_element_access(std::vector<float> v)
16 v.front(); // { dg-warning "ignoring return value" }
17 v.back(); // { dg-warning "ignoring return value" }
18 v[1]; // { dg-warning "ignoring return value" }
19 v.at(1); // { dg-warning "ignoring return value" }
20 v.data(); // { dg-warning "ignoring return value" }
21 const auto& cv = v;
22 cv[1]; // { dg-warning "ignoring return value" }
23 cv.at(1); // { dg-warning "ignoring return value" }
24 cv.data(); // { dg-warning "ignoring return value" }
27 void
28 test_rel_ops(std::vector<char> v)
30 v == v; // { dg-warning "ignoring return value" }
31 v != v; // { dg-warning "ignoring return value" "PR c++/114104" { target c++17_down } }
32 v < v; // { dg-warning "ignoring return value" }
33 v > v; // { dg-warning "ignoring return value" }
34 v <= v; // { dg-warning "ignoring return value" }
35 v >= v; // { dg-warning "ignoring return value" }
38 struct S { };
40 void
41 test_iterators(std::vector<S> v)
43 v.begin(); // { dg-warning "ignoring return value" }
44 v.end(); // { dg-warning "ignoring return value" }
45 v.rbegin(); // { dg-warning "ignoring return value" }
46 v.rend(); // { dg-warning "ignoring return value" }
47 const auto& cv = v;
48 cv.begin(); // { dg-warning "ignoring return value" }
49 cv.end(); // { dg-warning "ignoring return value" }
50 cv.rbegin(); // { dg-warning "ignoring return value" }
51 cv.rend(); // { dg-warning "ignoring return value" }
53 v.cbegin(); // { dg-warning "ignoring return value" }
54 v.cend(); // { dg-warning "ignoring return value" }
55 v.crbegin(); // { dg-warning "ignoring return value" }
56 v.crend(); // { dg-warning "ignoring return value" }
58 auto i = v.begin(), j = v.end();
59 i == j; // { dg-warning "ignoring return value" }
60 i != j; // { dg-warning "ignoring return value" "PR c++/114104" { target c++17_down } }
61 i < j; // { dg-warning "ignoring return value" }
62 i > j; // { dg-warning "ignoring return value" }
63 i <= j; // { dg-warning "ignoring return value" }
64 i >= j; // { dg-warning "ignoring return value" }
66 auto ci = cv.begin(), cj = cv.end();
67 ci == cj; // { dg-warning "ignoring return value" }
68 ci != cj; // { dg-warning "ignoring return value" "PR c++/114104" { target c++17_down } }
69 ci < cj; // { dg-warning "ignoring return value" }
70 ci > cj; // { dg-warning "ignoring return value" }
71 ci <= cj; // { dg-warning "ignoring return value" }
72 ci >= cj; // { dg-warning "ignoring return value" }
74 ci == j; // { dg-warning "ignoring return value" }
75 ci != j; // { dg-warning "ignoring return value" "PR c++/114104" { target c++17_down } }
76 ci < j; // { dg-warning "ignoring return value" }
77 ci > j; // { dg-warning "ignoring return value" }
78 ci <= j; // { dg-warning "ignoring return value" }
79 ci >= j; // { dg-warning "ignoring return value" }
82 void
83 test_observers(std::vector<bool> v)
85 v.size(); // { dg-warning "ignoring return value" }
86 v.capacity(); // { dg-warning "ignoring return value" }
87 v.empty(); // { dg-warning "ignoring return value" }
90 void
91 test_element_access(std::vector<bool> v)
93 v.front(); // { dg-warning "ignoring return value" }
94 v.back(); // { dg-warning "ignoring return value" }
95 v[1]; // { dg-warning "ignoring return value" }
96 v.at(1); // { dg-warning "ignoring return value" }
97 const auto& cv = v;
98 cv[1]; // { dg-warning "ignoring return value" }
99 cv.at(1); // { dg-warning "ignoring return value" }
102 void
103 test_rel_ops(std::vector<bool> v)
105 v == v; // { dg-warning "ignoring return value" }
106 v != v; // { dg-warning "ignoring return value" "PR c++/114104" { target c++17_down } }
107 v < v; // { dg-warning "ignoring return value" }
108 v > v; // { dg-warning "ignoring return value" }
109 v <= v; // { dg-warning "ignoring return value" }
110 v >= v; // { dg-warning "ignoring return value" }
113 void
114 test_iterators(std::vector<bool> v)
116 v.begin(); // { dg-warning "ignoring return value" }
117 v.end(); // { dg-warning "ignoring return value" }
118 v.rbegin(); // { dg-warning "ignoring return value" }
119 v.rend(); // { dg-warning "ignoring return value" }
120 const auto& cv = v;
121 cv.begin(); // { dg-warning "ignoring return value" }
122 cv.end(); // { dg-warning "ignoring return value" }
123 cv.rbegin(); // { dg-warning "ignoring return value" }
124 cv.rend(); // { dg-warning "ignoring return value" }
126 v.cbegin(); // { dg-warning "ignoring return value" }
127 v.cend(); // { dg-warning "ignoring return value" }
128 v.crbegin(); // { dg-warning "ignoring return value" }
129 v.crend(); // { dg-warning "ignoring return value" }
131 auto i = v.begin(), j = v.end();
132 i == j; // { dg-warning "ignoring return value" }
133 i != j; // { dg-warning "ignoring return value" "PR c++/114104" { target c++17_down } }
134 i < j; // { dg-warning "ignoring return value" }
135 i > j; // { dg-warning "ignoring return value" }
136 i <= j; // { dg-warning "ignoring return value" }
137 i >= j; // { dg-warning "ignoring return value" }
139 auto ci = cv.begin(), cj = cv.end();
140 ci == cj; // { dg-warning "ignoring return value" }
141 ci != cj; // { dg-warning "ignoring return value" "PR c++/114104" { target c++17_down } }
142 ci < cj; // { dg-warning "ignoring return value" }
143 ci > cj; // { dg-warning "ignoring return value" }
144 ci <= cj; // { dg-warning "ignoring return value" }
145 ci >= cj; // { dg-warning "ignoring return value" }
147 ci == j; // { dg-warning "ignoring return value" }
148 ci != j; // { dg-warning "ignoring return value" "PR c++/114104" { target c++17_down } }
149 ci < j; // { dg-warning "ignoring return value" }
150 ci > j; // { dg-warning "ignoring return value" }
151 ci <= j; // { dg-warning "ignoring return value" }
152 ci >= j; // { dg-warning "ignoring return value" }