Skip to content

Commit ad96d23

Browse files
Fix testing at runtime as well
1 parent 19c4395 commit ad96d23

File tree

1 file changed

+25
-8
lines changed
  • libcxx/test/std/containers/associative/map/map.access

1 file changed

+25
-8
lines changed

libcxx/test/std/containers/associative/map/map.access/at.pass.cpp

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,16 @@ TEST_CONSTEXPR_CXX26 bool test() {
4545
#ifndef TEST_HAS_NO_EXCEPTIONS
4646

4747
// throwing is not allowed in constexpr
48-
# if TEST_STD_VER < 26
48+
# if TEST_STD_VER >= 26
49+
if (!std::is_constant_evaluated()) {
50+
# endif
4951
try {
5052
TEST_IGNORE_NODISCARD m.at(6);
5153
assert(false);
5254
} catch (std::out_of_range&) {
5355
}
56+
# if TEST_STD_VER >= 26
57+
}
5458
# endif
5559

5660
#endif
@@ -77,20 +81,23 @@ TEST_CONSTEXPR_CXX26 bool test() {
7781
assert(m.at(4) == 4.5);
7882
assert(m.at(5) == 5.5);
7983
// throwing is not allowed in constexpr
80-
#if TEST_STD_VER < 26
84+
# if TEST_STD_VER >= 26
85+
if (!std::is_constant_evaluated()) {
86+
# endif
8187
try {
8288
TEST_IGNORE_NODISCARD m.at(6);
8389
assert(false);
8490
} catch (std::out_of_range&) {
8591
}
86-
#endif
92+
# if TEST_STD_VER >= 26
93+
}
94+
# endif
8795

8896
assert(m.at(7) == 7.5);
8997
assert(m.at(8) == 8.5);
9098
assert(m.size() == 7);
9199
}
92100
#if TEST_STD_VER >= 11
93-
// #ifdef VINAY_DISABLE_FOR_NOW
94101
{
95102
typedef std::pair<const int, double> V;
96103
V ar[] = {
@@ -115,13 +122,18 @@ TEST_CONSTEXPR_CXX26 bool test() {
115122
# ifndef TEST_HAS_NO_EXCEPTIONS
116123

117124
// throwing is not allowed in constexpr
118-
# if TEST_STD_VER < 26
125+
# if TEST_STD_VER >= 26
126+
if (!std::is_constant_evaluated()) {
127+
# endif
119128
try {
120129
TEST_IGNORE_NODISCARD m.at(6);
121130
assert(false);
122131
} catch (std::out_of_range&) {
123132
}
124-
# endif
133+
# if TEST_STD_VER >= 26
134+
}
135+
# endif
136+
125137
# endif
126138
assert(m.at(7) == 7.5);
127139
assert(m.at(8) == 8.5);
@@ -147,19 +159,24 @@ TEST_CONSTEXPR_CXX26 bool test() {
147159
assert(m.at(5) == 5.5);
148160
# ifndef TEST_HAS_NO_EXCEPTIONS
149161
// throwing is not allowed in constexpr
150-
# if TEST_STD_VER < 26
162+
# if TEST_STD_VER >= 26
163+
if (!std::is_constant_evaluated()) {
164+
# endif
151165
try {
152166
TEST_IGNORE_NODISCARD m.at(6);
153167
assert(false);
154168
} catch (std::out_of_range&) {
155169
}
170+
# if TEST_STD_VER >= 26
171+
}
172+
# endif
173+
156174
# endif
157175
# endif
158176
assert(m.at(7) == 7.5);
159177
assert(m.at(8) == 8.5);
160178
assert(m.size() == 7);
161179
}
162-
#endif
163180
return true;
164181
}
165182

0 commit comments

Comments
 (0)