[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
Fri Nov 18 12:25:25 PST 2022


bsdjhb updated this revision to Diff 476566.
bsdjhb marked an inline comment as done.
bsdjhb added a comment.

- Add tests.


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.476566.patch
Type: text/x-patch
Size: 1461 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20221118/6145d8f3/attachment.bin>


More information about the libcxx-commits mailing list