aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2018-01-15 15:02:01 +0000
committerJonathan Wakely <redi@gcc.gnu.org>2018-01-15 15:02:01 +0000
commitb0e63d94835956810fa056dbb06ea3741a6862ed (patch)
treef81885153c710356b08af74123c4205b5ec3c234
parente8f3b70ddb695c8f90fb076679de1b8edf04f1ef (diff)
downloadgcc-b0e63d94835956810fa056dbb06ea3741a6862ed.zip
gcc-b0e63d94835956810fa056dbb06ea3741a6862ed.tar.gz
gcc-b0e63d94835956810fa056dbb06ea3741a6862ed.tar.bz2
PR libstdc++/83830 Define std::has_unique_object_representations_v
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
-rw-r--r--libstdc++-v3/ChangeLog8
-rw-r--r--libstdc++-v3/include/std/type_traits4
-rw-r--r--libstdc++-v3/testsuite/20_util/has_unique_object_representations/value.cc14
3 files changed, 26 insertions, 0 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 92d96c4..572fbc6 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -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
diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits
index 43ea68e..711d6c5 100644
--- a/libstdc++-v3/include/std/type_traits
+++ b/libstdc++-v3/include/std/type_traits
@@ -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
diff --git a/libstdc++-v3/testsuite/20_util/has_unique_object_representations/value.cc b/libstdc++-v3/testsuite/20_util/has_unique_object_representations/value.cc
index c2a5873..7ac97cf 100644
--- a/libstdc++-v3/testsuite/20_util/has_unique_object_representations/value.cc
+++ b/libstdc++-v3/testsuite/20_util/has_unique_object_representations/value.cc
@@ -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);
+}