Skip to content

Commit d5322bc

Browse files
[libc++][test] Test LWG3819: reference_meows_from_temporary should...
not use `is_meowible` Actually, this LWG issue is not "Nothing To Do". But the changes need to be done by compilers, and library implementations can hardly do anything.
1 parent e30cba5 commit d5322bc

File tree

4 files changed

+49
-1
lines changed

4 files changed

+49
-1
lines changed

libcxx/docs/Status/Cxx23Issues.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@
261261
"`LWG3733 <https://wg21.link/LWG3733>`__","``ranges::to`` misuses ``cpp17-input-iterator``","2023-02 (Issaquah)","|Complete|","17",""
262262
"`LWG3742 <https://wg21.link/LWG3742>`__","``deque::prepend_range`` needs to permute","2023-02 (Issaquah)","","",""
263263
"`LWG3790 <https://wg21.link/LWG3790>`__","`P1467 <https://wg21.link/P1467>`__ accidentally changed ``nexttoward``'s signature","2023-02 (Issaquah)","","",""
264-
"`LWG3819 <https://wg21.link/LWG3819>`__","``reference_meows_from_temporary`` should not use ``is_meowible``","2023-02 (Issaquah)","","",""
264+
"`LWG3819 <https://wg21.link/LWG3819>`__","``reference_meows_from_temporary`` should not use ``is_meowible``","2023-02 (Issaquah)","|Nothing To Do|","",""
265265
"`LWG3821 <https://wg21.link/LWG3821>`__","``uses_allocator_construction_args`` should have overload for ``pair-like``","2023-02 (Issaquah)","|Complete|","18",""
266266
"`LWG3834 <https://wg21.link/LWG3834>`__","Missing ``constexpr`` for ``std::intmax_t`` math functions in ``<cinttypes>``","2023-02 (Issaquah)","","",""
267267
"`LWG3839 <https://wg21.link/LWG3839>`__","``range_formatter``'s ``set_separator``, ``set_brackets``, and ``underlying`` functions should be ``noexcept``","2023-02 (Issaquah)","|Complete|","17",""

libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/common.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,14 @@ class ExplicitConversionRef {
8585
explicit operator int&();
8686
};
8787

88+
struct NonMovable {
89+
NonMovable(NonMovable&&) = delete;
90+
};
91+
92+
struct ConvertsFromNonMovable {
93+
ConvertsFromNonMovable(NonMovable);
94+
};
95+
8896
#endif
8997

9098
#endif // TEST_META_UNARY_COMP_COMMON_H

libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/reference_constructs_from_temporary.pass.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ constexpr bool test() {
5858
assert((std::is_constructible_v<const int&, ConvertsToRef<long, long&>>));
5959
test_reference_constructs_from_temporary<const int&, ConvertsToRef<long, long&>, true>();
6060
#ifndef TEST_COMPILER_GCC
61+
// TODO: Remove this guard once https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120529 gets fixed.
6162
test_reference_constructs_from_temporary<const int&, ConvertsToRefPrivate<long, long&>, false>();
6263
#endif
6364

@@ -66,6 +67,25 @@ constexpr bool test() {
6667

6768
test_reference_constructs_from_temporary<const int&, long, true>();
6869

70+
#if defined(TEST_COMPILER_GCC) || (defined(TEST_CLANG_VER) && TEST_CLANG_VER >= 2100)
71+
// TODO: Remove this guard once no supported Clang is affected by https://github.com/llvm/llvm-project/issues/114344.
72+
73+
// Test function references.
74+
test_reference_constructs_from_temporary<void (&)(), void(), false>();
75+
test_reference_constructs_from_temporary<void (&&)(), void(), false>();
76+
77+
// Test cv-qualification dropping for scalar prvalues. LWG3819 also covers this.
78+
test_reference_constructs_from_temporary<int&&, const int, true>();
79+
test_reference_constructs_from_temporary<int&&, volatile int, true>();
80+
#endif
81+
82+
#if defined(TEST_CLANG_VER) && TEST_CLANG_VER >= 2100
83+
// TODO: Remove this guard once supported Clang and GCC have LWG3819 implemented.
84+
85+
// Test LWG3819: reference_meows_from_temporary should not use is_meowible.
86+
test_reference_constructs_from_temporary<ConvertsFromNonMovable&&, NonMovable, true>();
87+
#endif
88+
6989
// Additional checks
7090
test_reference_constructs_from_temporary<const Base&, Derived, true>();
7191
test_reference_constructs_from_temporary<int&&, int, true>();

libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/reference_converts_from_temporary.pass.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ constexpr bool test() {
5858
assert((std::is_constructible_v<const int&, ConvertsToRef<long, long&>>));
5959
test_reference_converts_from_temporary<const int&, ConvertsToRef<long, long&>, true>();
6060
#ifndef TEST_COMPILER_GCC
61+
// TODO: Remove this guard once https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120529 gets fixed.
6162
test_reference_converts_from_temporary<const int&, ConvertsToRefPrivate<long, long&>, false>();
6263
#endif
6364

@@ -66,6 +67,25 @@ constexpr bool test() {
6667

6768
test_reference_converts_from_temporary<const int&, long, true>();
6869

70+
#if defined(TEST_COMPILER_GCC) || (defined(TEST_CLANG_VER) && TEST_CLANG_VER >= 2100)
71+
// TODO: Remove this guard once no supported Clang is affected by https://github.com/llvm/llvm-project/issues/114344.
72+
73+
// Test function references.
74+
test_reference_converts_from_temporary<void (&)(), void(), false>();
75+
test_reference_converts_from_temporary<void (&&)(), void(), false>();
76+
77+
// Test cv-qualification dropping for scalar prvalues. LWG3819 also covers this.
78+
test_reference_converts_from_temporary<int&&, const int, true>();
79+
test_reference_converts_from_temporary<int&&, volatile int, true>();
80+
#endif
81+
82+
#if defined(TEST_CLANG_VER) && TEST_CLANG_VER >= 2100
83+
// TODO: Remove this guard once supported Clang and GCC have LWG3819 implemented.
84+
85+
// Test LWG3819: reference_meows_from_temporary should not use is_meowible.
86+
test_reference_converts_from_temporary<ConvertsFromNonMovable&&, NonMovable, true>();
87+
#endif
88+
6989
// Additional checks
7090
test_reference_converts_from_temporary<const Base&, Derived, true>();
7191
test_reference_converts_from_temporary<int&&, int, true>();

0 commit comments

Comments
 (0)