[libcxx-commits] [libcxx] 26fffc1 - [libc++] [test] {cpo, niebloid}.compile.pass.cpp: Also test their constness.

Arthur O'Dwyer via libcxx-commits libcxx-commits at lists.llvm.org
Sat Jan 22 08:55:18 PST 2022


Author: Arthur O'Dwyer
Date: 2022-01-22T11:53:00-05:00
New Revision: 26fffc1b8e755c60727d206a1f07a1ca1d299f48

URL: https://github.com/llvm/llvm-project/commit/26fffc1b8e755c60727d206a1f07a1ca1d299f48
DIFF: https://github.com/llvm/llvm-project/commit/26fffc1b8e755c60727d206a1f07a1ca1d299f48.diff

LOG: [libc++] [test] {cpo,niebloid}.compile.pass.cpp: Also test their constness.

This will detect if someone writes `inline auto cpo =` instead of
`inline constexpr auto cpo =`. I don't know how that'd be possible,
but it's easy to test, so let's test it.

Added: 
    

Modified: 
    libcxx/test/std/library/description/conventions/customization.point.object/cpo.compile.pass.cpp
    libcxx/test/std/library/description/conventions/customization.point.object/niebloid.compile.pass.cpp

Removed: 
    


################################################################################
diff  --git a/libcxx/test/std/library/description/conventions/customization.point.object/cpo.compile.pass.cpp b/libcxx/test/std/library/description/conventions/customization.point.object/cpo.compile.pass.cpp
index 4cd461631838d..819aeb454a45c 100644
--- a/libcxx/test/std/library/description/conventions/customization.point.object/cpo.compile.pass.cpp
+++ b/libcxx/test/std/library/description/conventions/customization.point.object/cpo.compile.pass.cpp
@@ -13,13 +13,16 @@
 // [range.adaptor.object] "A range adaptor object is a customization point object..."
 
 #include <compare>
+#include <concepts>
 #include <iterator>
 #include <ranges>
+#include <type_traits>
 #include <utility>
 
 // Test for basic properties of C++20 16.3.3.3.6 [customization.point.object].
 template <class CPO, class... Args>
 constexpr bool test(CPO& o, Args&&...) {
+  static_assert(std::is_const_v<CPO>);
   static_assert(std::is_class_v<CPO>);
   static_assert(std::is_trivial_v<CPO>);
 

diff  --git a/libcxx/test/std/library/description/conventions/customization.point.object/niebloid.compile.pass.cpp b/libcxx/test/std/library/description/conventions/customization.point.object/niebloid.compile.pass.cpp
index fcca5813dcb31..532fa5786f8e1 100644
--- a/libcxx/test/std/library/description/conventions/customization.point.object/niebloid.compile.pass.cpp
+++ b/libcxx/test/std/library/description/conventions/customization.point.object/niebloid.compile.pass.cpp
@@ -32,6 +32,7 @@
 
 template <class CPO, class... Args>
 constexpr bool test(CPO& o, Args&&...) {
+  static_assert(std::is_const_v<CPO>);
   static_assert(std::is_class_v<CPO>);
   static_assert(std::is_trivial_v<CPO>);
 


        


More information about the libcxx-commits mailing list