aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2019-05-24 16:09:33 +0000
committerJonathan Wakely <jwakely@redhat.com>2019-05-24 16:09:33 +0000
commit93779ad4967645229b2598bed346d86fbf0a59b5 (patch)
tree783f6f398fab4f64b593bf2a94699d30ad4e5535 /libstdc++-v3
parentc2357312a927a001264652c6c5b1fa682a7e267f (diff)
Fix uses of non-reserved names for template parameters
Backport from mainline 2019-05-17 Jonathan Wakely <jwakely@redhat.com> * include/bits/random.h (seed_seq::param): Fix non-reserved name. * include/experimental/type_traits (is_detected_exact) (is_detected_exact_v): Likewise. * include/pstl/execution_defs.h (is_execution_policy) (is_execution_policy_v, __enable_if_execution_policy): Likewise. * include/pstl/execution_impl.h (__policy_traits): Likewise. * testsuite/17_intro/names.cc: Check for more non-reserved names. * testsuite/experimental/names.cc: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-9-branch@271608 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3')
-rw-r--r--libstdc++-v3/ChangeLog12
-rw-r--r--libstdc++-v3/include/bits/random.h4
-rw-r--r--libstdc++-v3/include/experimental/type_traits8
-rw-r--r--libstdc++-v3/include/pstl/execution_defs.h12
-rw-r--r--libstdc++-v3/include/pstl/execution_impl.h2
-rw-r--r--libstdc++-v3/testsuite/17_intro/names.cc78
-rw-r--r--libstdc++-v3/testsuite/experimental/names.cc68
7 files changed, 170 insertions, 14 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index ca28ce46d6e..5e3284183b7 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -3,6 +3,18 @@
Backport from mainline
2019-05-17 Jonathan Wakely <jwakely@redhat.com>
+ * include/bits/random.h (seed_seq::param): Fix non-reserved name.
+ * include/experimental/type_traits (is_detected_exact)
+ (is_detected_exact_v): Likewise.
+ * include/pstl/execution_defs.h (is_execution_policy)
+ (is_execution_policy_v, __enable_if_execution_policy): Likewise.
+ * include/pstl/execution_impl.h (__policy_traits): Likewise.
+ * testsuite/17_intro/names.cc: Check for more non-reserved names.
+ * testsuite/experimental/names.cc: New test.
+
+ Backport from mainline
+ 2019-05-17 Jonathan Wakely <jwakely@redhat.com>
+
PR libstdc++/85965
* include/bits/hashtable.h (_Hashtable::~_Hashtable()): Remove static
assertions from the destructor.
diff --git a/libstdc++-v3/include/bits/random.h b/libstdc++-v3/include/bits/random.h
index 3f5ae53086e..2b1df4cb59e 100644
--- a/libstdc++-v3/include/bits/random.h
+++ b/libstdc++-v3/include/bits/random.h
@@ -6080,9 +6080,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
size_t size() const noexcept
{ return _M_v.size(); }
- template<typename OutputIterator>
+ template<typename _OutputIterator>
void
- param(OutputIterator __dest) const
+ param(_OutputIterator __dest) const
{ std::copy(_M_v.begin(), _M_v.end(), __dest); }
// no copy functions
diff --git a/libstdc++-v3/include/experimental/type_traits b/libstdc++-v3/include/experimental/type_traits
index ab1ba92c3c6..1b1f8acfea6 100644
--- a/libstdc++-v3/include/experimental/type_traits
+++ b/libstdc++-v3/include/experimental/type_traits
@@ -251,12 +251,12 @@ template<typename _Default, template<typename...> class _Op, typename... _Args>
template<typename _Default, template<typename...> class _Op, typename... _Args>
using detected_or_t = typename detected_or<_Default, _Op, _Args...>::type;
-template<typename Expected, template<typename...> class _Op, typename... _Args>
- using is_detected_exact = is_same<Expected, detected_t<_Op, _Args...>>;
+template<typename _Expected, template<typename...> class _Op, typename... _Args>
+ using is_detected_exact = is_same<_Expected, detected_t<_Op, _Args...>>;
-template<typename Expected, template<typename...> class _Op, typename... _Args>
+template<typename _Expected, template<typename...> class _Op, typename... _Args>
constexpr bool is_detected_exact_v
- = is_detected_exact<Expected, _Op, _Args...>::value;
+ = is_detected_exact<_Expected, _Op, _Args...>::value;
template<typename _To, template<typename...> class _Op, typename... _Args>
using is_detected_convertible
diff --git a/libstdc++-v3/include/pstl/execution_defs.h b/libstdc++-v3/include/pstl/execution_defs.h
index 9a4b49bd46a..1a551c7871c 100644
--- a/libstdc++-v3/include/pstl/execution_defs.h
+++ b/libstdc++-v3/include/pstl/execution_defs.h
@@ -117,7 +117,7 @@ constexpr parallel_unsequenced_policy par_unseq{};
constexpr unsequenced_policy unseq{};
// 2.3, Execution policy type trait
-template <class T>
+template <class _Tp>
struct is_execution_policy : std::false_type
{
};
@@ -142,8 +142,8 @@ struct is_execution_policy<__pstl::execution::unsequenced_policy> : std::true_ty
};
#if __PSTL_CPP14_VARIABLE_TEMPLATES_PRESENT
-template <class T>
-constexpr bool is_execution_policy_v = __pstl::execution::is_execution_policy<T>::value;
+template <class _Tp>
+constexpr bool is_execution_policy_v = __pstl::execution::is_execution_policy<_Tp>::value;
#endif
} // namespace v1
@@ -151,10 +151,10 @@ constexpr bool is_execution_policy_v = __pstl::execution::is_execution_policy<T>
namespace __internal
{
-template <class ExecPolicy, class T>
+template <class _ExecPolicy, class _Tp>
using __enable_if_execution_policy =
- typename std::enable_if<__pstl::execution::is_execution_policy<typename std::decay<ExecPolicy>::type>::value,
- T>::type;
+ typename std::enable_if<__pstl::execution::is_execution_policy<typename std::decay<_ExecPolicy>::type>::value,
+ _Tp>::type;
} // namespace __internal
} // namespace __pstl
diff --git a/libstdc++-v3/include/pstl/execution_impl.h b/libstdc++-v3/include/pstl/execution_impl.h
index 8ee5fa062a8..cbebbbd4239 100644
--- a/libstdc++-v3/include/pstl/execution_impl.h
+++ b/libstdc++-v3/include/pstl/execution_impl.h
@@ -66,7 +66,7 @@ struct __is_random_access_iterator<_IteratorType>
};
/* policy */
-template <typename Policy>
+template <typename _Policy>
struct __policy_traits
{
};
diff --git a/libstdc++-v3/testsuite/17_intro/names.cc b/libstdc++-v3/testsuite/17_intro/names.cc
index c3c753b35e5..66c639ff3a3 100644
--- a/libstdc++-v3/testsuite/17_intro/names.cc
+++ b/libstdc++-v3/testsuite/17_intro/names.cc
@@ -19,7 +19,6 @@
// Define macros for some common variables names that we must not use for
// naming variables, parameters etc. in the library.
-#define tmp (
#define A (
#define B (
#define C (
@@ -99,6 +98,78 @@
#define y (
#define z (
+#define tmp (
+
+#if __cplusplus < 201703L
+// <charconv> defines to_chars_result::ptr and to_chars_result::ec
+#define ec (
+#define ptr (
+#endif
+
+// Common template parameter names
+#define OutputIterator OutputIterator is not a reserved name
+#define InputIterator InputIterator is not a reserved name
+#define ForwardIterator ForwardIterator is not a reserved name
+#define BidirectionalIterator BidirectionalIterator is not a reserved name
+#define RandomAccessIterator RandomAccessIterator is not a reserved name
+#define RandomAccessOutputIterator RandomAccessOutputIterator is not a reserved name
+#define RAIter RAIter is not a reserved name
+#define FwdIter FwdIter is not a reserved name
+#define OutIter OutIter is not a reserved name
+#define InIter InIter is not a reserved name
+
+#define Alloc Alloc is not a reserved name
+#define BinaryFunction1 BinaryFunction1 is not a reserved name
+#define BinaryFunction2 BinaryFunction2 is not a reserved name
+#define Char Char is not a reserved name
+#define CharT CharT is not a reserved name
+#define Cmp Cmp is not a reserved name
+#define Compare Compare is not a reserved name
+#define Const_Iterator Const_Iterator is not a reserved name
+#define Const_Key_Reference Const_Key_Reference is not a reserved name
+#define Const_Node_Iter Const_Node_Iter is not a reserved name
+#define Const_Pointer Const_Pointer is not a reserved name
+#define Const_Reference Const_Reference is not a reserved name
+#define Data Data is not a reserved name
+#define DiffType DiffType is not a reserved name
+#define Eq Eq is not a reserved name
+#define ExecPolicy ExecPolicy is not a reserved name
+#define Expected Expected is not a reserved name
+#define External_Load_Access External_Load_Access is not a reserved name
+#define External_Size_Access External_Size_Access is not a reserved name
+#define Fn Fn is not a reserved name
+#define Function Function is not a reserved name
+#define Functor Functor is not a reserved name
+#define Hash Hash is not a reserved name
+#define H1 H1 is not a reserved name
+#define H2 H2 is not a reserved name
+#define Head Head is not a reserved name
+#define It It is not a reserved name
+#define Iter Iter is not a reserved name
+#define Iterator Iterator is not a reserved name
+#define Key Key is not a reserved name
+#define Mapped Mapped is not a reserved name
+#define Node Node is not a reserved name
+#define Node_iter Node_iter is not a reserved name
+#define Node_ptr Node_ptr is not a reserved name
+#define Overflow Overflow is not a reserved name
+#define Pointer Pointer is not a reserved name
+#define Policy Policy is not a reserved name
+#define Pred Pred is not a reserved name
+#define Ptr Ptr is not a reserved name
+#define Reference Reference is not a reserved name
+#define Seq Seq is not a reserved name
+#define Seq_RAIter Seq_RAIter is not a reserved name
+#define Series Series is not a reserved name
+#define Set Set is not a reserved name
+#define String String is not a reserved name
+#define Tp Tp is not a reserved name
+#define Traits Traits is not a reserved name
+#define Type Type is not a reserved name
+#define Value Value is not a reserved name
+#define ValueT ValueT is not a reserved name
+#define ValueType ValueType is not a reserved name
+
#ifdef _AIX
// See https://gcc.gnu.org/ml/libstdc++/2017-03/msg00015.html
#undef f
@@ -116,4 +187,9 @@
#undef y
#endif
+#ifdef __sun__
+// See https://gcc.gnu.org/ml/libstdc++/2019-05/msg00175.html
+#undef ptr
+#endif
+
#include <bits/stdc++.h>
diff --git a/libstdc++-v3/testsuite/experimental/names.cc b/libstdc++-v3/testsuite/experimental/names.cc
new file mode 100644
index 00000000000..233b3487981
--- /dev/null
+++ b/libstdc++-v3/testsuite/experimental/names.cc
@@ -0,0 +1,68 @@
+// Copyright (C) 2017-2019 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-do compile }
+
+// Define macros for some common variables names that we must not use for
+// naming variables, parameters etc. in the library.
+
+#include "../17_intro/names.cc"
+// Filesystem
+#if __has_include(<experimental/filesystem>)
+# include <experimental/filesystem>
+#endif
+// Library Fundamentals
+#include <experimental/algorithm>
+#include <experimental/any>
+#include <experimental/array>
+#include <experimental/chrono>
+#include <experimental/deque>
+#include <experimental/forward_list>
+#include <experimental/functional>
+#include <experimental/iterator>
+#include <experimental/list>
+#include <experimental/map>
+#include <experimental/memory>
+#include <experimental/memory_resource>
+#include <experimental/numeric>
+#include <experimental/optional>
+#include <experimental/propagate_const>
+#include <experimental/random>
+#include <experimental/ratio>
+#include <experimental/regex>
+#include <experimental/set>
+#include <experimental/source_location>
+#include <experimental/string>
+#include <experimental/string_view>
+#include <experimental/system_error>
+#include <experimental/tuple>
+#include <experimental/type_traits>
+#include <experimental/unordered_map>
+#include <experimental/unordered_set>
+#include <experimental/utility>
+#include <experimental/vector>
+// Networking
+#ifdef _GLIBCXX_HAS_GTHREADS
+# include <experimental/buffer>
+# include <experimental/internet>
+# include <experimental/io_context>
+# include <experimental/net>
+# include <experimental/netfwd>
+# include <experimental/socket>
+# include <experimental/timer>
+# include <experimental/executor>
+#endif