PR libstdc++/83830 Define std::has_unique_object_representations_v
authorJonathan Wakely <jwakely@redhat.com>
Mon, 15 Jan 2018 15:02:01 +0000 (15:02 +0000)
committerJonathan Wakely <redi@gcc.gnu.org>
Mon, 15 Jan 2018 15:02:01 +0000 (15:02 +0000)
PR libstdc++/83830
* include/std/type_traits (has_unique_object_representations_v): Add
variable template.
* testsuite/20_util/has_unique_object_representations/value.cc: Check
variable template.

From-SVN: r256701

libstdc++-v3/ChangeLog
libstdc++-v3/include/std/type_traits
libstdc++-v3/testsuite/20_util/has_unique_object_representations/value.cc

index 92d96c46fb74eba5df1e2254471a5a96c2e04d31..572fbc68a08152f8aa5aef097f16b6f2b57cda4a 100644 (file)
@@ -1,3 +1,11 @@
+2018-01-15  Jonathan Wakely  <jwakely@redhat.com>
+
+       PR libstdc++/83830
+       * include/std/type_traits (has_unique_object_representations_v): Add
+       variable template.
+       * testsuite/20_util/has_unique_object_representations/value.cc: Check
+       variable template.
+
 2018-01-15  Ville Voutilainen  <ville.voutilainen@gmail.com>
 
        Make optional conditionally
index 43ea68e6c6b32c94cf7db87cd3c593cd97d24dfd..711d6c50dd141ff3fb332ea88f5ce6f83958ada7 100644 (file)
@@ -2903,6 +2903,10 @@ template <typename _From, typename _To>
       remove_cv_t<remove_all_extents_t<_Tp>>
       )>
     { };
+
+  template<typename _Tp>
+    inline constexpr bool has_unique_object_representations_v
+      = has_unique_object_representations<_Tp>::value;
 #endif
 #undef _GLIBCXX_HAVE_BUILTIN_HAS_UNIQ_OBJ_REP
 
index c2a5873ee6923757e0ac2c29ac708bc813676084..7ac97cf0ba4285078d86e0080b43fe8e212b88ec 100644 (file)
@@ -108,3 +108,17 @@ void test01()
   static_assert(test_category<has_unique_object_representations,
                Aligned[][1]>(false), "");
 }
+
+void
+test02()
+{
+  using std::has_unique_object_representations;
+  using std::has_unique_object_representations_v;
+
+  static_assert(has_unique_object_representations_v<int>
+               == has_unique_object_representations<int>::value);
+  static_assert(has_unique_object_representations_v<void>
+               == has_unique_object_representations<void>::value);
+  static_assert(has_unique_object_representations_v<float>
+               == has_unique_object_representations<float>::value);
+}