Skip to content

Commit d4ae572

Browse files
author
Bogdan Graur
committed
code review adjustments.
1 parent a941e8c commit d4ae572

File tree

5 files changed

+9
-13
lines changed

5 files changed

+9
-13
lines changed

libcxx/docs/Status/Cxx20Papers.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@
173173
"`P1868R2 <https://wg21.link/P1868R2>`__","LWG","width: clarifying units of width and precision in std::format","Prague","|Complete|","14.0"
174174
"`P1937R2 <https://wg21.link/P1937R2>`__","CWG","Fixing inconsistencies between constexpr and consteval functions","Prague","* *",""
175175
"`P1956R1 <https://wg21.link/P1956R1>`__","LWG","On the names of low-level bit manipulation functions","Prague","|Complete|","12.0"
176-
"`P1957R2 <https://wg21.link/P1957R2>`__","CWG","Converting from ``T*``\ to bool should be considered narrowing (re: US 212)","Prague","* *",""
176+
"`P1957R2 <https://wg21.link/P1957R2>`__","CWG","Converting from ``T*``\ to bool should be considered narrowing (re: US 212)","Prague","|Complete|","18.0"
177177
"`P1963R0 <https://wg21.link/P1963R0>`__","LWG","Fixing US 313","Prague","* *","",""
178178
"`P1964R2 <https://wg21.link/P1964R2>`__","LWG","Wording for boolean-testable","Prague","|Complete|","13.0"
179179
"`P1970R2 <https://wg21.link/P1970R2>`__","LWG","Consistency for size() functions: Add ranges::ssize","Prague","|Complete|","15.0","|ranges|"

libcxx/test/std/utilities/variant/variant.variant/variant.assign/T.pass.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ void test_T_assignment_sfinae() {
146146
};
147147
static_assert(!std::is_assignable<V, X>::value,
148148
"no boolean conversion in operator=");
149-
#if defined(_LIBCPP_ENABLE_NARROWING_CONVERSIONS_IN_VARIANT)
149+
#ifdef _LIBCPP_ENABLE_NARROWING_CONVERSIONS_IN_VARIANT
150150
static_assert(!std::is_assignable<V, std::false_type>::value,
151151
"no converted to bool in operator=");
152152
#else
@@ -301,25 +301,23 @@ void test_T_assignment_performs_assignment() {
301301
#endif // TEST_HAS_NO_EXCEPTIONS
302302
}
303303

304-
#if !defined(_LIBCPP_ENABLE_NARROWING_CONVERSIONS_IN_VARIANT)
305304
void test_T_assignment_vector_bool() {
305+
#ifndef _LIBCPP_ENABLE_NARROWING_CONVERSIONS_IN_VARIANT
306306
std::vector<bool> vec = {true};
307307
std::variant<bool, int> v;
308308
v = vec[0];
309309
assert(v.index() == 0);
310310
assert(std::get<0>(v) == true);
311-
}
312311
#endif
312+
}
313313

314314
int main(int, char**) {
315315
test_T_assignment_basic();
316316
test_T_assignment_performs_construction();
317317
test_T_assignment_performs_assignment();
318318
test_T_assignment_noexcept();
319319
test_T_assignment_sfinae();
320-
#if !defined(_LIBCPP_ENABLE_NARROWING_CONVERSIONS_IN_VARIANT)
321320
test_T_assignment_vector_bool();
322-
#endif
323321

324322
return 0;
325323
}

libcxx/test/std/utilities/variant/variant.variant/variant.assign/conv.pass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ int main(int, char**)
3333

3434
static_assert(!std::is_assignable<std::variant<int, bool>, decltype("meow")>::value, "");
3535
static_assert(!std::is_assignable<std::variant<int, const bool>, decltype("meow")>::value, "");
36-
#if defined(_LIBCPP_ENABLE_NARROWING_CONVERSIONS_IN_VARIANT)
36+
#ifdef _LIBCPP_ENABLE_NARROWING_CONVERSIONS_IN_VARIANT
3737
static_assert(!std::is_assignable<std::variant<int, const volatile bool>, decltype("meow")>::value, "");
3838
static_assert(!std::is_assignable<std::variant<bool>, std::true_type>::value, "");
3939
#else

libcxx/test/std/utilities/variant/variant.variant/variant.ctor/T.pass.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ void test_T_ctor_sfinae() {
8080
};
8181
static_assert(!std::is_constructible<V, X>::value,
8282
"no boolean conversion in constructor");
83-
#if defined(_LIBCPP_ENABLE_NARROWING_CONVERSIONS_IN_VARIANT)
83+
#ifdef _LIBCPP_ENABLE_NARROWING_CONVERSIONS_IN_VARIANT
8484
static_assert(!std::is_constructible<V, std::false_type>::value,
8585
"no converted to bool in constructor");
8686
#else
@@ -204,23 +204,21 @@ void test_construction_with_repeated_types() {
204204
static_assert(std::is_constructible<V, Bar>::value, "");
205205
}
206206

207-
#if !defined(_LIBCPP_ENABLE_NARROWING_CONVERSIONS_IN_VARIANT)
208207
void test_vector_bool() {
208+
#ifndef _LIBCPP_ENABLE_NARROWING_CONVERSIONS_IN_VARIANT
209209
std::vector<bool> vec = {true};
210210
std::variant<bool, int> v = vec[0];
211211
assert(v.index() == 0);
212212
assert(std::get<0>(v) == true);
213-
}
214213
#endif
214+
}
215215

216216
int main(int, char**) {
217217
test_T_ctor_basic();
218218
test_T_ctor_noexcept();
219219
test_T_ctor_sfinae();
220220
test_no_narrowing_check_for_class_types();
221221
test_construction_with_repeated_types();
222-
#if !defined(_LIBCPP_ENABLE_NARROWING_CONVERSIONS_IN_VARIANT)
223222
test_vector_bool();
224-
#endif
225223
return 0;
226224
}

libcxx/test/std/utilities/variant/variant.variant/variant.ctor/conv.pass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ int main(int, char**)
3232

3333
static_assert(!std::is_constructible<std::variant<int, bool>, decltype("meow")>::value, "");
3434
static_assert(!std::is_constructible<std::variant<int, const bool>, decltype("meow")>::value, "");
35-
#if defined(_LIBCPP_ENABLE_NARROWING_CONVERSIONS_IN_VARIANT)
35+
#ifdef _LIBCPP_ENABLE_NARROWING_CONVERSIONS_IN_VARIANT
3636
static_assert(!std::is_constructible<std::variant<int, const volatile bool>, decltype("meow")>::value, "");
3737
static_assert(!std::is_constructible<std::variant<bool>, std::true_type>::value, "");
3838
#else

0 commit comments

Comments
 (0)