diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2019-05-17 15:13:40 +0100 |
---|---|---|
committer | Jonathan Wakely <redi@gcc.gnu.org> | 2019-05-17 15:13:40 +0100 |
commit | 593cda3e61f6645d4999b7065b6f49ce631567a3 (patch) | |
tree | 70dbe1c10c15c9413ff7a916151c7066c2db1e90 | |
parent | e625ccc21a91f3d6976dece2ae736ab4cbe36763 (diff) | |
download | gcc-593cda3e61f6645d4999b7065b6f49ce631567a3.zip gcc-593cda3e61f6645d4999b7065b6f49ce631567a3.tar.gz gcc-593cda3e61f6645d4999b7065b6f49ce631567a3.tar.bz2 |
Fix uses of non-reserved names for template parameters
* 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.
From-SVN: r271324
-rw-r--r-- | libstdc++-v3/ChangeLog | 9 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/random.h | 4 | ||||
-rw-r--r-- | libstdc++-v3/include/experimental/type_traits | 8 | ||||
-rw-r--r-- | libstdc++-v3/include/pstl/execution_defs.h | 12 | ||||
-rw-r--r-- | libstdc++-v3/include/pstl/execution_impl.h | 2 | ||||
-rw-r--r-- | libstdc++-v3/testsuite/17_intro/names.cc | 73 | ||||
-rw-r--r-- | libstdc++-v3/testsuite/experimental/names.cc | 64 |
7 files changed, 158 insertions, 14 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 6e404b2..397b8ed 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,14 @@ 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. + 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 3f5ae53..2b1df4c 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 c2b2dcc..2403bd2 100644 --- a/libstdc++-v3/include/experimental/type_traits +++ b/libstdc++-v3/include/experimental/type_traits @@ -252,12 +252,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 9a4b49b..1a551c7 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 8ee5fa0..cbebbbd 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 c3c753b..20123a4 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 diff --git a/libstdc++-v3/testsuite/experimental/names.cc b/libstdc++-v3/testsuite/experimental/names.cc new file mode 100644 index 0000000..e97baf3 --- /dev/null +++ b/libstdc++-v3/testsuite/experimental/names.cc @@ -0,0 +1,64 @@ +// 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 +#include <experimental/filesystem> +// 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 +#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> |