[libcxx-commits] [libcxx] [libc++][test] Test LWG3819: `reference_meows_from_temporary` should not use `is_meowible` (PR #143474)
A. Jiang via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Sep 2 23:07:33 PDT 2025
https://github.com/frederick-vs-ja updated https://github.com/llvm/llvm-project/pull/143474
>From 25aeb8538beec68e0cf105b21ca797aa8e8ce603 Mon Sep 17 00:00:00 2001
From: "A. Jiang" <de34 at live.cn>
Date: Wed, 4 Jun 2025 20:23:58 +0800
Subject: [PATCH 1/2] [libc++][test] Test LWG3819:
`reference_meows_from_temporary` should not use `is_meowible`
Changes need to be done by compilers, while library implementations can
hardly do anything. So the version number actually corresponds to Clang.
---
libcxx/docs/Status/Cxx23Issues.csv | 2 +-
.../meta/meta.unary/meta.unary.prop/common.h | 8 ++++++++
...ference_constructs_from_temporary.pass.cpp | 20 +++++++++++++++++++
...reference_converts_from_temporary.pass.cpp | 20 +++++++++++++++++++
4 files changed, 49 insertions(+), 1 deletion(-)
diff --git a/libcxx/docs/Status/Cxx23Issues.csv b/libcxx/docs/Status/Cxx23Issues.csv
index d1546f4a452b5..f53aad179db70 100644
--- a/libcxx/docs/Status/Cxx23Issues.csv
+++ b/libcxx/docs/Status/Cxx23Issues.csv
@@ -261,7 +261,7 @@
"`LWG3733 <https://wg21.link/LWG3733>`__","``ranges::to`` misuses ``cpp17-input-iterator``","2023-02 (Issaquah)","|Complete|","17",""
"`LWG3742 <https://wg21.link/LWG3742>`__","``deque::prepend_range`` needs to permute","2023-02 (Issaquah)","","",""
"`LWG3790 <https://wg21.link/LWG3790>`__","`P1467 <https://wg21.link/P1467>`__ accidentally changed ``nexttoward``'s signature","2023-02 (Issaquah)","","",""
-"`LWG3819 <https://wg21.link/LWG3819>`__","``reference_meows_from_temporary`` should not use ``is_meowible``","2023-02 (Issaquah)","","",""
+"`LWG3819 <https://wg21.link/LWG3819>`__","``reference_meows_from_temporary`` should not use ``is_meowible``","2023-02 (Issaquah)","|Complete|","21","Changes are made in compilers but not libraries. The version number corresponds to Clang."
"`LWG3821 <https://wg21.link/LWG3821>`__","``uses_allocator_construction_args`` should have overload for ``pair-like``","2023-02 (Issaquah)","|Complete|","18",""
"`LWG3834 <https://wg21.link/LWG3834>`__","Missing ``constexpr`` for ``std::intmax_t`` math functions in ``<cinttypes>``","2023-02 (Issaquah)","","",""
"`LWG3839 <https://wg21.link/LWG3839>`__","``range_formatter``'s ``set_separator``, ``set_brackets``, and ``underlying`` functions should be ``noexcept``","2023-02 (Issaquah)","|Complete|","17",""
diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/common.h b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/common.h
index b51444915a5c5..4fba34e3817be 100644
--- a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/common.h
+++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/common.h
@@ -85,6 +85,14 @@ class ExplicitConversionRef {
explicit operator int&();
};
+struct NonMovable {
+ NonMovable(NonMovable&&) = delete;
+};
+
+struct ConvertsFromNonMovable {
+ ConvertsFromNonMovable(NonMovable);
+};
+
#endif
#endif // TEST_META_UNARY_COMP_COMMON_H
diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/reference_constructs_from_temporary.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/reference_constructs_from_temporary.pass.cpp
index ad53c8176cc92..04f7b48a46bbf 100644
--- a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/reference_constructs_from_temporary.pass.cpp
+++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/reference_constructs_from_temporary.pass.cpp
@@ -58,6 +58,7 @@ constexpr bool test() {
assert((std::is_constructible_v<const int&, ConvertsToRef<long, long&>>));
test_reference_constructs_from_temporary<const int&, ConvertsToRef<long, long&>, true>();
#ifndef TEST_COMPILER_GCC
+ // TODO: Remove this guard once https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120529 gets fixed.
test_reference_constructs_from_temporary<const int&, ConvertsToRefPrivate<long, long&>, false>();
#endif
@@ -66,6 +67,25 @@ constexpr bool test() {
test_reference_constructs_from_temporary<const int&, long, true>();
+#if defined(TEST_COMPILER_GCC) || (defined(TEST_CLANG_VER) && TEST_CLANG_VER >= 2100)
+ // TODO: Remove this guard once no supported Clang is affected by https://github.com/llvm/llvm-project/issues/114344.
+
+ // Test function references.
+ test_reference_constructs_from_temporary<void (&)(), void(), false>();
+ test_reference_constructs_from_temporary<void (&&)(), void(), false>();
+
+ // Test cv-qualification dropping for scalar prvalues. LWG3819 also covers this.
+ test_reference_constructs_from_temporary<int&&, const int, true>();
+ test_reference_constructs_from_temporary<int&&, volatile int, true>();
+#endif
+
+#if defined(TEST_CLANG_VER) && TEST_CLANG_VER >= 2100
+ // TODO: Remove this guard once supported Clang and GCC have LWG3819 implemented.
+
+ // Test LWG3819: reference_meows_from_temporary should not use is_meowible.
+ test_reference_constructs_from_temporary<ConvertsFromNonMovable&&, NonMovable, true>();
+#endif
+
// Additional checks
test_reference_constructs_from_temporary<const Base&, Derived, true>();
test_reference_constructs_from_temporary<int&&, int, true>();
diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/reference_converts_from_temporary.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/reference_converts_from_temporary.pass.cpp
index 73cc4f3e29d5a..543ced79a7d3e 100644
--- a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/reference_converts_from_temporary.pass.cpp
+++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/reference_converts_from_temporary.pass.cpp
@@ -58,6 +58,7 @@ constexpr bool test() {
assert((std::is_constructible_v<const int&, ConvertsToRef<long, long&>>));
test_reference_converts_from_temporary<const int&, ConvertsToRef<long, long&>, true>();
#ifndef TEST_COMPILER_GCC
+ // TODO: Remove this guard once https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120529 gets fixed.
test_reference_converts_from_temporary<const int&, ConvertsToRefPrivate<long, long&>, false>();
#endif
@@ -66,6 +67,25 @@ constexpr bool test() {
test_reference_converts_from_temporary<const int&, long, true>();
+#if defined(TEST_COMPILER_GCC) || (defined(TEST_CLANG_VER) && TEST_CLANG_VER >= 2100)
+ // TODO: Remove this guard once no supported Clang is affected by https://github.com/llvm/llvm-project/issues/114344.
+
+ // Test function references.
+ test_reference_converts_from_temporary<void (&)(), void(), false>();
+ test_reference_converts_from_temporary<void (&&)(), void(), false>();
+
+ // Test cv-qualification dropping for scalar prvalues. LWG3819 also covers this.
+ test_reference_converts_from_temporary<int&&, const int, true>();
+ test_reference_converts_from_temporary<int&&, volatile int, true>();
+#endif
+
+#if defined(TEST_CLANG_VER) && TEST_CLANG_VER >= 2100
+ // TODO: Remove this guard once supported Clang and GCC have LWG3819 implemented.
+
+ // Test LWG3819: reference_meows_from_temporary should not use is_meowible.
+ test_reference_converts_from_temporary<ConvertsFromNonMovable&&, NonMovable, true>();
+#endif
+
// Additional checks
test_reference_converts_from_temporary<const Base&, Derived, true>();
test_reference_converts_from_temporary<int&&, int, true>();
>From 016ae31b5397bfb58ee7cd5a96cfad2376073ba4 Mon Sep 17 00:00:00 2001
From: "A. Jiang" <de34 at live.cn>
Date: Mon, 1 Sep 2025 15:39:04 +0800
Subject: [PATCH 2/2] Address @philnik777's review comments and tweak macro
guards
---
libcxx/docs/Status/Cxx23Issues.csv | 2 +-
.../reference_constructs_from_temporary.pass.cpp | 14 +++++++++++---
.../reference_converts_from_temporary.pass.cpp | 14 +++++++++++---
3 files changed, 23 insertions(+), 7 deletions(-)
diff --git a/libcxx/docs/Status/Cxx23Issues.csv b/libcxx/docs/Status/Cxx23Issues.csv
index f53aad179db70..fe81a092df66d 100644
--- a/libcxx/docs/Status/Cxx23Issues.csv
+++ b/libcxx/docs/Status/Cxx23Issues.csv
@@ -261,7 +261,7 @@
"`LWG3733 <https://wg21.link/LWG3733>`__","``ranges::to`` misuses ``cpp17-input-iterator``","2023-02 (Issaquah)","|Complete|","17",""
"`LWG3742 <https://wg21.link/LWG3742>`__","``deque::prepend_range`` needs to permute","2023-02 (Issaquah)","","",""
"`LWG3790 <https://wg21.link/LWG3790>`__","`P1467 <https://wg21.link/P1467>`__ accidentally changed ``nexttoward``'s signature","2023-02 (Issaquah)","","",""
-"`LWG3819 <https://wg21.link/LWG3819>`__","``reference_meows_from_temporary`` should not use ``is_meowible``","2023-02 (Issaquah)","|Complete|","21","Changes are made in compilers but not libraries. The version number corresponds to Clang."
+"`LWG3819 <https://wg21.link/LWG3819>`__","``reference_meows_from_temporary`` should not use ``is_meowible``","2023-02 (Issaquah)","|Complete|","22","Changes are made in compilers but not libraries. The version number corresponds to Clang."
"`LWG3821 <https://wg21.link/LWG3821>`__","``uses_allocator_construction_args`` should have overload for ``pair-like``","2023-02 (Issaquah)","|Complete|","18",""
"`LWG3834 <https://wg21.link/LWG3834>`__","Missing ``constexpr`` for ``std::intmax_t`` math functions in ``<cinttypes>``","2023-02 (Issaquah)","","",""
"`LWG3839 <https://wg21.link/LWG3839>`__","``range_formatter``'s ``set_separator``, ``set_brackets``, and ``underlying`` functions should be ``noexcept``","2023-02 (Issaquah)","|Complete|","17",""
diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/reference_constructs_from_temporary.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/reference_constructs_from_temporary.pass.cpp
index 04f7b48a46bbf..fc9817a4a0983 100644
--- a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/reference_constructs_from_temporary.pass.cpp
+++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/reference_constructs_from_temporary.pass.cpp
@@ -67,8 +67,12 @@ constexpr bool test() {
test_reference_constructs_from_temporary<const int&, long, true>();
-#if defined(TEST_COMPILER_GCC) || (defined(TEST_CLANG_VER) && TEST_CLANG_VER >= 2100)
- // TODO: Remove this guard once no supported Clang is affected by https://github.com/llvm/llvm-project/issues/114344.
+#if defined(TEST_COMPILER_GCC) || \
+ (defined(TEST_CLANG_VER) && \
+ ((!defined(__ANDROID__) && TEST_CLANG_VER >= 2100) || (defined(__ANDROID__) && TEST_CLANG_VER >= 2200))) || \
+ (defined(TEST_APPLE_CLANG_VER) && TEST_APPLE_CLANG_VER >= 1800)
+ // TODO: Bump the version numbers if newer Apple Clang or Android Clang hasn't implemented LWG3819 yet.
+ // TODO: Remove this guard once no supported Clang is affected by https://llvm.org/PR114344.
// Test function references.
test_reference_constructs_from_temporary<void (&)(), void(), false>();
@@ -79,7 +83,11 @@ constexpr bool test() {
test_reference_constructs_from_temporary<int&&, volatile int, true>();
#endif
-#if defined(TEST_CLANG_VER) && TEST_CLANG_VER >= 2100
+#if !defined(TEST_COMPILER_GCC) && \
+ ((defined(TEST_CLANG_VER) && \
+ ((!defined(__ANDROID__) && TEST_CLANG_VER >= 2100) || (defined(__ANDROID__) && TEST_CLANG_VER >= 2200))) || \
+ (defined(TEST_APPLE_CLANG_VER) && TEST_APPLE_CLANG_VER >= 1800))
+ // TODO: Bump the version numbers if newer Apple Clang or Android Clang hasn't implemented LWG3819 yet.
// TODO: Remove this guard once supported Clang and GCC have LWG3819 implemented.
// Test LWG3819: reference_meows_from_temporary should not use is_meowible.
diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/reference_converts_from_temporary.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/reference_converts_from_temporary.pass.cpp
index 543ced79a7d3e..aeb5310468fe7 100644
--- a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/reference_converts_from_temporary.pass.cpp
+++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/reference_converts_from_temporary.pass.cpp
@@ -67,8 +67,12 @@ constexpr bool test() {
test_reference_converts_from_temporary<const int&, long, true>();
-#if defined(TEST_COMPILER_GCC) || (defined(TEST_CLANG_VER) && TEST_CLANG_VER >= 2100)
- // TODO: Remove this guard once no supported Clang is affected by https://github.com/llvm/llvm-project/issues/114344.
+#if defined(TEST_COMPILER_GCC) || \
+ (defined(TEST_CLANG_VER) && \
+ ((!defined(__ANDROID__) && TEST_CLANG_VER >= 2100) || (defined(__ANDROID__) && TEST_CLANG_VER >= 2200))) || \
+ (defined(TEST_APPLE_CLANG_VER) && TEST_APPLE_CLANG_VER >= 1800)
+ // TODO: Bump the version numbers if newer Apple Clang or Android Clang hasn't implemented LWG3819 yet.
+ // TODO: Remove this guard once no supported Clang is affected by https://llvm.org/PR114344.
// Test function references.
test_reference_converts_from_temporary<void (&)(), void(), false>();
@@ -79,7 +83,11 @@ constexpr bool test() {
test_reference_converts_from_temporary<int&&, volatile int, true>();
#endif
-#if defined(TEST_CLANG_VER) && TEST_CLANG_VER >= 2100
+#if !defined(TEST_COMPILER_GCC) && \
+ ((defined(TEST_CLANG_VER) && \
+ ((!defined(__ANDROID__) && TEST_CLANG_VER >= 2100) || (defined(__ANDROID__) && TEST_CLANG_VER >= 2200))) || \
+ (defined(TEST_APPLE_CLANG_VER) && TEST_APPLE_CLANG_VER >= 1800))
+ // TODO: Bump the version numbers if newer Apple Clang or Android Clang hasn't implemented LWG3819 yet.
// TODO: Remove this guard once supported Clang and GCC have LWG3819 implemented.
// Test LWG3819: reference_meows_from_temporary should not use is_meowible.
More information about the libcxx-commits
mailing list