From 555de0c52261f97704a967a1309e52af808f5b76 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Wed, 15 Jun 2022 19:46:02 -0700 Subject: [PATCH 1/2] Implement and test P1328R1 constexpr type_info::operator==(). --- stl/inc/yvals_core.h | 2 ++ .../test.compile.pass.cpp | 19 +++++++++++++++++-- .../test.compile.pass.cpp | 14 ++++++++++++++ 3 files changed, 33 insertions(+), 2 deletions(-) diff --git a/stl/inc/yvals_core.h b/stl/inc/yvals_core.h index f0f9f46f74..cd11bb858b 100644 --- a/stl/inc/yvals_core.h +++ b/stl/inc/yvals_core.h @@ -295,6 +295,7 @@ // P1132R7 out_ptr(), inout_ptr() // P1147R1 Printing volatile Pointers // P1272R4 byteswap() +// P1328R1 constexpr type_info::operator==() // P1413R3 Deprecate aligned_storage And aligned_union // P1425R4 Iterator Pair Constructors For stack And queue // P1659R3 ranges::starts_with, ranges::ends_with @@ -1456,6 +1457,7 @@ #define __cpp_lib_associative_heterogeneous_erasure 202110L #define __cpp_lib_byteswap 202110L +#define __cpp_lib_constexpr_typeinfo 202106L #ifdef __cpp_lib_concepts #define __cpp_lib_expected 202202L diff --git a/tests/std/tests/P2273R3_constexpr_unique_ptr/test.compile.pass.cpp b/tests/std/tests/P2273R3_constexpr_unique_ptr/test.compile.pass.cpp index 485776bc15..ffb367768b 100644 --- a/tests/std/tests/P2273R3_constexpr_unique_ptr/test.compile.pass.cpp +++ b/tests/std/tests/P2273R3_constexpr_unique_ptr/test.compile.pass.cpp @@ -3,6 +3,7 @@ #include #include +#include #include using namespace std; @@ -13,7 +14,7 @@ struct Dummy { } }; -constexpr bool test() { +constexpr bool test_P2273R3_constexpr_unique_ptr() { // [memory.syn] { auto p1 = make_unique(42); @@ -126,6 +127,20 @@ constexpr bool test() { return true; } -static_assert(test()); +static_assert(test_P2273R3_constexpr_unique_ptr()); + +// Also test P1328R1 constexpr type_info::operator==() +constexpr bool test_P1328R1_constexpr_type_info_equality() { + assert(typeid(int) == typeid(int)); + assert(typeid(int) != typeid(double)); + + assert(typeid(int) == typeid(int&)); // N4910 [expr.typeid]/5 + assert(typeid(int) == typeid(const int&)); // N4910 [expr.typeid]/5 + assert(typeid(int) == typeid(const int)); // N4910 [expr.typeid]/6 + + return true; +} + +static_assert(test_P1328R1_constexpr_type_info_equality()); int main() {} // COMPILE-ONLY diff --git a/tests/std/tests/VSO_0157762_feature_test_macros/test.compile.pass.cpp b/tests/std/tests/VSO_0157762_feature_test_macros/test.compile.pass.cpp index df1982a120..bd264cbd65 100644 --- a/tests/std/tests/VSO_0157762_feature_test_macros/test.compile.pass.cpp +++ b/tests/std/tests/VSO_0157762_feature_test_macros/test.compile.pass.cpp @@ -592,6 +592,20 @@ STATIC_ASSERT(__cpp_lib_constexpr_tuple == 201811L); #endif #endif +#if _HAS_CXX23 +#ifndef __cpp_lib_constexpr_typeinfo +#error __cpp_lib_constexpr_typeinfo is not defined +#elif __cpp_lib_constexpr_typeinfo != 202106L +#error __cpp_lib_constexpr_typeinfo is not 202106L +#else +STATIC_ASSERT(__cpp_lib_constexpr_typeinfo == 202106L); +#endif +#else +#ifdef __cpp_lib_constexpr_typeinfo +#error __cpp_lib_constexpr_typeinfo is defined +#endif +#endif + #if _HAS_CXX20 #ifndef __cpp_lib_constexpr_utility #error __cpp_lib_constexpr_utility is not defined From 2951f2289a2e52eb8d9ce63c5573f89d9a4e939d Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Wed, 15 Jun 2022 21:18:49 -0700 Subject: [PATCH 2/2] Activate libcxx coverage. --- tests/libcxx/expected_results.txt | 3 --- tests/libcxx/skipped_tests.txt | 3 --- 2 files changed, 6 deletions(-) diff --git a/tests/libcxx/expected_results.txt b/tests/libcxx/expected_results.txt index 0e88fa65a1..1c6d8e89f2 100644 --- a/tests/libcxx/expected_results.txt +++ b/tests/libcxx/expected_results.txt @@ -234,9 +234,6 @@ std/utilities/meta/meta.unary/meta.unary.prop/is_literal_type.deprecated.fail.cp std/language.support/support.limits/support.limits.general/tuple.version.pass.cpp FAIL std/language.support/support.limits/support.limits.general/utility.version.pass.cpp FAIL -# P1328R1 constexpr type_info::operator==() -std/language.support/support.limits/support.limits.general/typeinfo.version.pass.cpp FAIL - # *** MISSING COMPILER FEATURES *** # Nothing here! :-) diff --git a/tests/libcxx/skipped_tests.txt b/tests/libcxx/skipped_tests.txt index 2ec0963356..131cf451ee 100644 --- a/tests/libcxx/skipped_tests.txt +++ b/tests/libcxx/skipped_tests.txt @@ -234,9 +234,6 @@ utilities\meta\meta.unary\meta.unary.prop\is_literal_type.deprecated.fail.cpp language.support\support.limits\support.limits.general\tuple.version.pass.cpp language.support\support.limits\support.limits.general\utility.version.pass.cpp -# P1328R1 constexpr type_info::operator==() -language.support\support.limits\support.limits.general\typeinfo.version.pass.cpp - # *** MISSING COMPILER FEATURES *** # Nothing here! :-)