[libcxx-commits] [PATCH] D135469: [libc++] <type_traits>: Avoid instantiating a pointer type.

John Baldwin via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sat Nov 19 11:07:25 PST 2022


bsdjhb updated this revision to Diff 476693.
bsdjhb added a comment.

Adjust formatting.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D135469/new/

https://reviews.llvm.org/D135469

Files:
  libcxx/include/__type_traits/decay.h
  libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/decay.pass.cpp


Index: libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/decay.pass.cpp
===================================================================
--- libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/decay.pass.cpp
+++ libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/decay.pass.cpp
@@ -29,10 +29,14 @@
     test_decay<int, int>();
     test_decay<const volatile int, int>();
     test_decay<int*, int*>();
+    test_decay<int&, int>();
+    test_decay<const volatile int&, int>();
     test_decay<int[3], int*>();
     test_decay<const int[3], const int*>();
     test_decay<void(), void (*)()>();
 #if TEST_STD_VER > 11
+    test_decay<int&&, int>();
+    test_decay<const volatile int&&, int>();
     test_decay<int(int) const, int(int) const>();
     test_decay<int(int) volatile, int(int) volatile>();
     test_decay<int(int)  &, int(int)  &>();
Index: libcxx/include/__type_traits/decay.h
===================================================================
--- libcxx/include/__type_traits/decay.h
+++ libcxx/include/__type_traits/decay.h
@@ -42,7 +42,7 @@
     typedef _LIBCPP_NODEBUG typename conditional
                      <
                          is_array<_Up>::value,
-                         __remove_extent_t<_Up>*,
+                         __add_pointer_t<__remove_extent_t<_Up> >,
                          typename conditional
                          <
                               is_function<_Up>::value,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D135469.476693.patch
Type: text/x-patch
Size: 1458 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20221119/f95a4e78/attachment.bin>


More information about the libcxx-commits mailing list