summaryrefslogtreecommitdiff
path: root/libstdc++-v3/include/std
AgeCommit message (Collapse)Author
2018-01-04Protect optional's deduction guide with the feature macroville
Backport from mainline 2018-01-03 Ville Voutilainen <ville.voutilainen@gmail.com> Protect optional's deduction guide with the feature macro * include/std/optional: Use the feature macro. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@256261 138bc75d-0d04-0410-961f-82ee72b054a4
2017-12-14PR libstdc++/59568 don't use putback or update value when extraction failsredi
PR libstdc++/59568 * include/std/complex (operator>>): Only use putback if a character was successfully extracted and only set the value if a number was successfully extracted. * testsuite/26_numerics/complex/inserters_extractors/char/59568.cc: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@255633 138bc75d-0d04-0410-961f-82ee72b054a4
2017-12-12PR libstdc++/83395 fix invocable traits for INVOKE<cv void>redi
PR libstdc++/83395 * include/std/type_traits (__is_invocable_impl): Remove partial specialization for INVOKE<void> and restore is_void<R> check in primary template. (__is_nt_invocable_impl): Likewise. * testsuite/20_util/is_invocable/83395.cc: New test. * testsuite/20_util/is_nothrow_invocable/83395.cc: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@255585 138bc75d-0d04-0410-961f-82ee72b054a4
2017-12-01PR libstdc++/83134 Ensure std::__not_ converts B::value to boolredi
Backport from mainline 2017-11-23 Jonathan Wakely <jwakely@redhat.com> PR libstdc++/83134 * include/std/type_traits (__not_): Explicitly convert to bool. * testsuite/20_util/declval/requirements/1_neg.cc: Adjust dg-error. * testsuite/20_util/logical_traits/83134.cc: New test. * testsuite/20_util/make_signed/requirements/typedefs_neg.cc: Adjust dg-error. * testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@255329 138bc75d-0d04-0410-961f-82ee72b054a4
2017-12-01Add noexcept to std::integral_constant membersredi
Backport from mainline 2017-12-01 Jonathan Wakely <jwakely@redhat.com> * include/std/type_traits (integral_constant): Make member functions noexcept (LWG 2346). * include/std/utility (integer_sequence): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@255328 138bc75d-0d04-0410-961f-82ee72b054a4
2017-12-01Add noexcept to std::shared_future copy operations (LWG DR 2799)redi
Backport from mainline 2017-11-16 Jonathan Wakely <jwakely@redhat.com> * include/std/future (shared_future): Add noexcept to copy constructor and copy-assignment operator (LWG 2799). git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@255327 138bc75d-0d04-0410-961f-82ee72b054a4
2017-12-01PR libstdc++/82685 add 'noexcept' to string_view literalsredi
Backport from mainline 2017-10-24 Jonathan Wakely <jwakely@redhat.com> PR libstdc++/82685 * include/experimental/string_view (operator""sv): Add noexcept. * include/std/string_view (operator""sv): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@255325 138bc75d-0d04-0410-961f-82ee72b054a4
2017-10-20Update value of __cpp_lib_chrono feature-test macroredi
* include/std/chrono (__cpp_lib_chrono): Update macro value to indicate support for P0505R0. * testsuite/20_util/duration/arithmetic/constexpr_c++17.cc: Check for updated macro. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@253960 138bc75d-0d04-0410-961f-82ee72b054a4
2017-10-20PR libstdc++/82481 Suppress clang-tidy warningsredi
Backport from mainline 2017-10-13 Jonathan Wakely <jwakely@redhat.com> PR libstdc++/82481 * include/std/mutex (call_once): Suppress clang-tidy warnings about dangling references. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@253944 138bc75d-0d04-0410-961f-82ee72b054a4
2017-10-20PR libstdc++/79433 no #error for including headers with wrong -stdredi
Backport from mainline 2017-09-12 Jonathan Wakely <jwakely@redhat.com> PR libstdc++/79433 * doc/xml/manual/status_cxx2017.xml: Update feature-test macros. * doc/html/*: Regenerate. * include/Makefile.am: Remove <bits/c++17_warning.h>. * include/Makefile.in: Regenerate. * include/bits/c++17_warning.h: Remove. * include/bits/string_view.tcc: Do not include <bits/c++17_warning.h> for pre-C++17 modes. * include/std/any: Likewise. (__cpp_lib_any): Define. * include/std/mutex (__cpp_lib_scoped_lock): Adjust value as per new SD-6 draft. * include/std/numeric (__cpp_lib_gcd_lcm): Define as per new SD-6 draft. * include/std/optional: Do not include <bits/c++17_warning.h>. (__cpp_lib_optional): Define. * include/std/shared_mutex: Do not include <bits/c++14_warning.h>. * include/std/string_view: Do not include <bits/c++17_warning.h>. (__cpp_lib_string_view): Define. * include/std/variant: Do not include <bits/c++17_warning.h>. (__cpp_lib_variant): Define. * testsuite/20_util/optional/cons/value_neg.cc: Adjust dg-error line numbers. * testsuite/26_numerics/gcd/1.cc: Test for __cpp_lib_gcd_lcm. * testsuite/26_numerics/gcd/gcd_neg.cc: Adjust dg-error line numbers. * testsuite/26_numerics/lcm/1.cc: Test for __cpp_lib_gcd_lcm. * testsuite/26_numerics/lcm/lcm_neg.cc: Adjust dg-error line numbers. * testsuite/30_threads/scoped_lock/requirements/typedefs.cc: Adjust expected value of __cpp_lib_scoped_lock. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@253943 138bc75d-0d04-0410-961f-82ee72b054a4
2017-09-20PR libstdc++/82262 fix std::hash<std::optional<const T>>redi
PR libstdc++/82262 * include/std/optional (__optional_hash_call_base): Add template parameter for remove_const_t<_Tp> and use it consistently. * testsuite/20_util/optional/hash.cc: Test optional<const T>. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@253015 138bc75d-0d04-0410-961f-82ee72b054a4
2017-09-20PR libstdc++/82254 fix std::is_nothrow_invocable_r w.r.t throwing conversionsredi
PR libstdc++/82254 * include/std/type_traits (__is_invocable): Add partial specialization for INVOKE<void> case and remove is_void<R> check from partial specialization for INVOKE<R> case. (__is_nt_invocable_impl): New helper for is_nothrow_invocable_r. (is_nothrow_invocable_r): Use __is_nt_invocable_impl. * testsuite/20_util/is_nothrow_invocable/value.cc: Add tests for conversions that can throw or fail to convert. Use static assert strings to explain negative results. * testsuite/20_util/is_nothrow_invocable/value_ext.cc: Use is_nothrow_constructible in is_nt_invocable_conv. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@253014 138bc75d-0d04-0410-961f-82ee72b054a4
2017-09-13PR libstdc++/81468 constrain std::chrono::time_point constructorredi
PR libstdc++/81468 * include/std/chrono (time_point(const time_point<_Dur2>&)): Add missing constraint from LWG DR 1177. * testsuite/20_util/duration/cons/dr1177.cc: New. * testsuite/20_util/time_point/cons/81468.cc: New. * testsuite/20_util/duration/literals/range.cc: Update dg-error line. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@252090 138bc75d-0d04-0410-961f-82ee72b054a4
2017-09-12PR libstdc++/70483 make std::string_view fully constexprredi
Backport from mainline 2017-09-11 Jonathan Wakely <jwakely@redhat.com> PR libstdc++/70483 * include/bits/string_view.tcc (basic_string_view::find) (basic_string_view::rfind, basic_string_view::find_first_of) (basic_string_view::find_last_of, basic_string_view::find_first_not_of) (basic_string_view::find_last_not_of): Add constexpr specifier. * include/std/string_view (basic_string_view::operator=) (basic_string_view::rbegin, basic_string_view::rend) (basic_string_view::crbegin, basic_string_view::crend) (basic_string_view::remove_prefix, basic_string_view::remove_suffix) (basic_string_view::swap, basic_string_view::compare) (basic_string_view::find, basic_string_view::rfind) (basic_string_view::find_first_of, basic_string_view::find_last_of) (basic_string_view::find_first_not_of) (basic_string_view::find_last_not_of, basic_string_view::_M_check) (basic_string_view::_M_limit, operator==, operator!=, operator<) (operator>, operator<=, operator>=): Likewise. * testsuite/21_strings/basic_string_view/modifiers/remove_prefix/ char/1.cc: Repeat tests in constexpr context. * testsuite/21_strings/basic_string_view/modifiers/remove_prefix/ wchar_t/1.cc: Likewise. * testsuite/21_strings/basic_string_view/modifiers/remove_suffix/ char/1.cc: Likewise. * testsuite/21_strings/basic_string_view/modifiers/remove_suffix/ wchar_t/1.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/find/char/1.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/find/char/2.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/find/char/3.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/find/wchar_t/1.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/find/wchar_t/2.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/find/wchar_t/3.cc: Likewise. * testsuite/21_strings/basic_string_view/operators/char/2.cc: Likewise. * testsuite/21_strings/basic_string_view/operators/wchar_t/2.cc: Likewise. * testsuite/21_strings/basic_string_view/range_access/char/1.cc: Test cbegin, cend, rbegin, rend, crbegin and crend. * testsuite/21_strings/basic_string_view/range_access/wchar_t/1.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/compare/char/1.cc: Remove trailing whitespace. * testsuite/21_strings/basic_string_view/operations/compare/wchar_t/ 1.cc: Likewise. * testsuite/21_strings/basic_string_view/modifiers/swap/char/1.cc: New. * testsuite/21_strings/basic_string_view/modifiers/swap/wchar_t/1.cc: New. * testsuite/21_strings/basic_string_view/operations/compare/char/2.cc: New. * testsuite/21_strings/basic_string_view/operations/compare/wchar_t/ 2.cc: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@252031 138bc75d-0d04-0410-961f-82ee72b054a4
2017-09-04Fix test for __has_unique_object_representations support in Clangredi
Backport from mainline 2017-08-09 Jonathan Wakely <jwakely@redhat.com> * include/std/type_traits (_GLIBCXX_NO_BUILTIN_HAS_UNIQ_OBJ_REP): Replace with _GLIBCXX_HAVE_BUILTIN_HAS_UNIQ_OBJ_REP and use __is_identifier to set it. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@251656 138bc75d-0d04-0410-961f-82ee72b054a4
2017-09-04Fix test for __is_aggregate support in Clangredi
Backport from mainline 2017-08-09 Katsuhiko Nishimra <ktns.87@gmail.com> * include/std/type_traits (_GLIBCXX_HAVE_BUILTIN_IS_AGGREGATE): Use __is_identifier instead of __has_builtin. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@251655 138bc75d-0d04-0410-961f-82ee72b054a4
2017-09-04PR libstdc++/81338 correctly manage string capacityredi
Backport from mainline 2017-07-10 Jonathan Wakely <jwakely@redhat.com> PR libstdc++/81338 * include/bits/basic_string.h [_GLIBCXX_USE_CXX11_ABI] (basic_string): Declare basic_stringbuf to be a friend. * include/bits/sstream.tcc (basic_stringbuf::overflow) [_GLIBCXX_USE_CXX11_ABI]: Use unused capacity before reallocating. * include/std/sstream (basic_stringbuf::__xfer_bufptrs): Update string length to buffer length. * testsuite/27_io/basic_stringstream/assign/81338.cc: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@251652 138bc75d-0d04-0410-961f-82ee72b054a4
2017-08-14PR libstdc++/53984 handle exceptions in basic_istream::sentryredi
Backport from mainline 2017-07-25 Jonathan Wakely <jwakely@redhat.com> PR libstdc++/53984 * include/bits/basic_ios.h (basic_ios::_M_setstate): Adjust comment. * include/bits/istream.tcc (basic_istream::sentry): Handle exceptions during construction. * include/std/istream: Adjust comments for formatted input functions and unformatted input functions. * testsuite/27_io/basic_fstream/53984.cc: New. * testsuite/27_io/basic_istream/sentry/char/53984.cc: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@251089 138bc75d-0d04-0410-961f-82ee72b054a4
2017-07-25Reorder std::scoped_lock parameters as per P0739R0 DR statusredi
Backport from mainline 2017-07-15 Jonathan Wakely <jwakely@redhat.com> * include/std/mutex (scoped_lock): Reorder std::adopt_lock_t parameter as per P0739R0. * testsuite/30_threads/scoped_lock/cons/1.cc: Reorder arguments. * testsuite/30_threads/scoped_lock/cons/deduction.cc: Test deduction with std::adopt_lock_t. * testsuite/30_threads/scoped_lock/requirements/typedefs.cc: Check feature-test macro. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@250535 138bc75d-0d04-0410-961f-82ee72b054a4
2017-07-25Constrain std::variant constructor for class template argument deductionredi
Backport from mainline 2017-07-14 Jason Merrill <jason@redhat.com> Jonathan Wakely <jwakely@redhat.com> * include/std/variant (variant::variant(_Tp&&)): Constrain to remove the constructor for empty variants from the candidate functions during class template argument deduction. * testsuite/20_util/variant/deduction.cc: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@250534 138bc75d-0d04-0410-961f-82ee72b054a4
2017-07-25PR libstdc++/80939 Remove unmeetable constexpr specifiersredi
Backport from mainline 2017-06-02 Jonathan Wakely <jwakely@redhat.com> PR libstdc++/80939 * include/std/variant (__erased_ctor, __erased_assign, __erased_swap) (__erased_hash): Remove constexpr specifier and qualify calls to __ref_cast. (__erased_dtor): Remove constexpr specifier and use _Destroy. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@250533 138bc75d-0d04-0410-961f-82ee72b054a4
2017-07-25PR libstdc++/80737 backport std::variant fix from mainlineredi
Backport from mainline 2017-05-20 Tim Shen <timshen@google.com> PR libstdc++/80737 * include/std/variant(variant::variant): SFINAE on is_same first. * testsuite/20_util/variant/any.cc: test case. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@250532 138bc75d-0d04-0410-961f-82ee72b054a4
2017-07-11PR libstdc++/80316 make promise::set_value throw no_state errorredi
Backport from mainline 2017-04-21 Jonathan Wakely <jwakely@redhat.com> PR libstdc++/80316 * include/std/future (_State_baseV2::_Setter::operator()): Remove _S_check calls that are done after the pointer to the shared state is already dereferenced. (_State_baseV2::_Setter<_Res, void>): Define specialization for void as partial specialization so it can be defined within the definition of _State_baseV2. (_State_baseV2::__setter): Call _S_check. (_State_baseV2::__setter(promise<void>*)): Add overload for use by promise<void>::set_value and promise<void>::set_value_at_thread_exit. (promise<T>, promise<T&>, promise<void>): Make _State a friend. (_State_baseV2::_Setter<void, void>): Remove explicit specialization. (promise<void>::set_value, promise<void>::set_value_at_thread_exit): Use new __setter overload. * testsuite/30_threads/promise/members/at_thread_exit2.cc: New test. * testsuite/30_threads/promise/members/set_exception.cc: Test promise<T&> and promise<void> specializations. * testsuite/30_threads/promise/members/set_exception2.cc: Likewise. Test for no_state error condition. * testsuite/30_threads/promise/members/set_value2.cc: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@250126 138bc75d-0d04-0410-961f-82ee72b054a4
2017-06-21PR libstdc++/80675, PR libstdc++/80940ville
Backport from mainline 2017-06-21 Ville Voutilainen <ville.voutilainen@gmail.com> PR libstdc++/80675 PR libstdc++/80940 * include/std/istream: (__is_convertible_to_basic_istream_test(basic_istream<_Ch, _Up>*)): New. (__do_is_convertible_to_basic_istream_impl): Likewise. (__is_convertible_to_basic_istream_impl): Likewise. (__is_convertible_to_basic_istream): Use the new base. (__rvalue_istream_type): New. (operator>>(_Istream&&, _Tp&&)): Use the new helper alias for the SFINAE check, convert to the helper alias type before doing the actual extraction. * include/std/ostream: (__is_convertible_to_basic_ostream_test(basic_ostream<_Ch, _Up>*)): New. (__do_is_convertible_to_basic_ostream_impl): Likewise. (__is_convertible_to_basic_ostream_impl): Likewise. (__is_convertible_to_basic_ostream): Use the new base. (__rvalue_ostream_type): New. (operator<<(_Ostream&&, const _Tp&)): Use the new helper alias for the SFINAE check, convert to the helper alias type before doing the actual insertion. * testsuite/27_io/rvalue_streams-2.cc: Add new tests. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@249471 138bc75d-0d04-0410-961f-82ee72b054a4
2017-05-18PR libstdc++/80478 make std::mem_fn work with noexcept functionsredi
PR libstdc++/80478 * include/std/functional (_Mem_fn_traits_base): Add specializations for noexcept member function types. * testsuite/20_util/function_objects/mem_fn/80478.cc: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@248247 138bc75d-0d04-0410-961f-82ee72b054a4
2017-05-12PR libstdc++/78939 make tuple_size<cv T> depend on tuple_size<T>redi
PR libstdc++/78939 * include/std/utility (tuple_size<cv T>) [__cplusplus > 201402L]: Only define partial specializations when tuple_size<T>::value is valid. * testsuite/20_util/tuple/78939.cc: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@247978 138bc75d-0d04-0410-961f-82ee72b054a4
2017-04-19PR libstdc++/80446 cope with libc defining __has_builtinredi
PR libstdc++/80446 * include/std/type_traits (is_aggregate): Change __has_builtin checks. * libsupc++/new (launder): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@246992 138bc75d-0d04-0410-961f-82ee72b054a4
2017-04-18Fix incorrect results from std::boyer_moore_searcherredi
* include/std/functional (default_searcher, __boyer_moore_array_base) (__is_std_equal_to, __boyer_moore_base_t, boyer_moore_searcher) (boyer_moore_horspool_searcher): Remove redundant namespace qualification. (default_searcher::operator()): Construct return value early and advance second member in-place. (boyer_moore_horspool_searcher::operator()): Increment random access iterator directly instead of using std::next. (boyer_moore_searcher::operator()): Fix return value. * testsuite/20_util/function_objects/searchers.cc: Check both parts of return values. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@246964 138bc75d-0d04-0410-961f-82ee72b054a4
2017-04-03Implement std::is_aggregate.ville
* include/std/type_traits (is_aggregate, is_aggregate_v): New. * testsuite/20_util/is_aggregate/requirements/explicit_instantiation.cc: New. * testsuite/20_util/is_aggregate/requirements/typedefs.cc: Likewise. * testsuite/20_util/is_aggregate/value.cc: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@246651 138bc75d-0d04-0410-961f-82ee72b054a4
2017-03-28Implement LWG 2900, The copy and move constructorsville
of optional are not constexpr. * include/std/optional (_Optional_payload): New. (_Optional_base): Remove the bool parameter. (_Optional_base<_Tp, false>): Remove. (_Optional_base()): Adjust. (_Optional_base(nullopt_t)): Likewise. (_Optional_base(in_place_t, _Args&&...)): Likewise. (_Optional_base(in_place_t, initializer_list<_Up>, _Args&&...)): Likewise. (_Optional_base(const _Optional_base&)): Likewise. (_Optional_base(_Optional_base&&)): Likewise. (operator=(const _Optional_base&)): Likewise. (operator=(_Optional_base&&)): Likewise. (~_Optional_base()): Remove. (_M_is_engaged()): Adjust. (_M_get()): Likewise. (_M_construct(_Args&&...)): Likewise. (_M_destruct()): Likewise. (_M_reset()): Likewise. (_Optional_base::_Empty_byte): Remove. (_Optional_base::_M_empty): Remove. (_Optional_base::_M_payload): Adjust. * testsuite/20_util/optional/cons/value_neg.cc: Adjust. * testsuite/20_util/optional/constexpr/cons/value.cc: Add tests. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@246556 138bc75d-0d04-0410-961f-82ee72b054a4
2017-03-23Implement LWG 2686, std::hash<error_condition>, for C++17redi
2017-03-23 Daniel Kruegler <daniel.kruegler@gmail.com> Implement LWG 2686, Why is std::hash specialized for error_code, but not error_condition? * include/std/system_error (hash<error_condition>): Define for C++17. * testsuite/20_util/hash/operators/size_t.cc (hash<error_condition>): Instantiate test for error_condition. * testsuite/20_util/hash/requirements/explicit_instantiation.cc (hash<error_condition>): Instantiate hash<error_condition>. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@246424 138bc75d-0d04-0410-961f-82ee72b054a4
2017-03-23Implement P0607R0 "Inline Variables for Standard Library" for C++17redi
2017-03-23 Daniel Kruegler <daniel.kruegler@gmail.com> * include/bits/c++config (_GLIBCXX17_INLINE): Define. * include/bits/regex_constants.h (All std::regex_constants constants): Add _GLIBCXX17_INLINE as per P0607R0. * include/bits/std_mutex.h (defer_lock, try_to_lock, adopt_lock): Likewise. * include/bits/stl_pair.h (piecewise_construct): Likewise. * include/bits/uses_allocator.h (allocator_arg, uses_allocator_v) (__is_uses_allocator_constructible_v) (__is_nothrow_uses_allocator_constructible_v): Likewise. * include/std/chrono (treat_as_floating_point_v): Likewise. * include/std/functional (is_bind_expression_v, is_placeholder_v): Likewise. * include/std/optional (nullopt): Likewise. * include/std/ratio (ratio_equal_v, ratio_not_equal_v, ratio_less_v) ratio_less_equal_v, ratio_greater_v, ratio_greater_equal_v): Likewise. * include/std/system_error (is_error_code_enum_v) (is_error_condition_enum_v): Likewise. * include/std/tuple (tuple_size_v, ignore): Likewise. (ignore): Declare ignore constexpr as per LWG 2773, declare assignment constexpr as per LWG 2933. * include/std/type_traits (All variable templates): Add _GLIBCXX17_INLINE as per P0607R0. * include/std/variant (variant_size_v, variant_npos, __index_of_v) (__tuple_count_v, __exactly_once): Likewise. * testsuite/18_support/headers/new/synopsis.cc (hardware_destructive_interference_size) (hardware_constructive_interference_size): Likewise for commented-out variables. * testsuite/20_util/tuple/creation_functions/constexpr.cc: Add new test function for constexpr std::ignore (LWG 2773). * testsuite/20_util/tuple/creation_functions/constexpr_cpp14.cc: New test for LWG 2933. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@246423 138bc75d-0d04-0410-961f-82ee72b054a4
2017-03-22Add deduction guides for C++17 (P0433R2, partial)redi
* include/bits/shared_ptr.h (shared_ptr, weak_ptr): Add deduction guides for C++17. * include/bits/std_function.h (function): Likewise. * include/bits/stl_pair.h (pair): Likewise. * include/debug/array (__gnu_debug::array): Likewise. * include/std/array (array): Likewise. * include/std/functional (make_default_searcher) (make_boyer_moore_searcher, make_boyer_moore_horspool_searcher): Remove generator functions. * include/std/tuple (tuple): Add deduction guides. * include/std/valarray (valarray): Likewise. * testsuite/20_util/function_objects/searchers.cc: Adjust to use class template argument deduction instead of generator functions. * testsuite/20_util/function/cons/deduction.cc: New test. * testsuite/20_util/optional/cons/deduction_guide.cc: Rename to ... * testsuite/20_util/optional/cons/deduction.cc: ... here. * testsuite/20_util/pair/cons/deduction.cc: New test. * testsuite/20_util/shared_ptr/cons/deduction.cc: New test. * testsuite/20_util/tuple/cons/deduction.cc: New test. * testsuite/20_util/tuple/element_access/get_neg.cc: Adjust dg-error. * testsuite/20_util/unique_ptr/cons/deduction_neg.cc: New test. * testsuite/20_util/weak_ptr/cons/deduction.cc: New test. * testsuite/23_containers/array/cons/deduction.cc: New test. * testsuite/23_containers/array/cons/deduction_neg.cc: New test. * testsuite/23_containers/array/tuple_interface/get_debug_neg.cc: Adjust dg-error. * testsuite/23_containers/array/tuple_interface/get_neg.cc: Likewise. * testsuite/23_containers/array/tuple_interface/tuple_element_neg.cc: Likewise. * testsuite/26_numerics/valarray/deduction.cc: New test. * testsuite/30_threads/lock_guard/cons/deduction.cc: New test. * testsuite/30_threads/scoped_lock/cons/deduction.cc: New test. * testsuite/30_threads/unique_lock/cons/deduction.cc: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@246389 138bc75d-0d04-0410-961f-82ee72b054a4
2017-03-15Implement LWG 2857, {variant,optional,any}::emplace shouldville
return the constructed value. * include/std/any (emplace(_Args&&...)): Change the return type and return a reference to the constructed value. (emplace(initializer_list<_Up>, _Args&&...)): Likewise. * include/std/optional (emplace(_Args&&...)): Likewise. (emplace(initializer_list<_Up>, _Args&&...)): Likewise. * include/std/variant (emplace<_Tp>(_Args&&...)): Likewise. (emplace<_Tp>(initializer_list<_Up>, _Args&&...)): Likewise. (emplace<_Np>(_Args&&...)): Likewise. (emplace<_Np>(initializer_list<_Up>, _Args&&...)): Likewise. * testsuite/20_util/any/assign/emplace.cc: Add tests for checking the return value of emplace. * testsuite/20_util/any/misc/any_cast_neg.cc: Adjust. * testsuite/20_util/optional/assignment/6.cc: Add tests for checking the return value of emplace. * testsuite/20_util/variant/run.cc: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@246182 138bc75d-0d04-0410-961f-82ee72b054a4
2017-03-13Implement LWG 2806, Base class of bad_optional_access.ville
* include/std/optional (bad_optional_access): Derive from std::exception. (bad_optional_access::bad_optional_access): Adjust. (bad_optional_access::what): New. (__throw_bad_optional_access(const char*)): Remove the parameter and adjust calls. * testsuite/20_util/optional/cons/value_neg.cc: Adjust. * testsuite/20_util/optional/typedefs.cc: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@246103 138bc75d-0d04-0410-961f-82ee72b054a4
2017-03-12Implement LWG 2934, optional<const T> doesn't compare with T.ville
* include/std/optional (operator==(const optional<_Tp>&, const optional<_Tp>&)): Turn into operator==(const optional<_Tp>&, const optional<_Up>&). (operator!=(const optional<_Tp>&, const optional<_Tp>&)): Turn into operator!=(const optional<_Tp>&, const optional<_Up>&). (operator<(const optional<_Tp>&, const optional<_Tp>&)): Turn into operator<(const optional<_Tp>&, const optional<_Up>&. (operator>(const optional<_Tp>&, const optional<_Tp>&)): Turn into operator>(const optional<_Tp>&, const optional<_Up>&. (operator<=(const optional<_Tp>&, const optional<_Tp>&)): Turn into operator<=(const optional<_Tp>&, const optional<_Up>&). (operator>=(const optional<_Tp>&, const optional<_Tp>&)): Turn into operator>=(const optional<_Tp>&, const optional<_Up>&). (operator==(const optional<_Tp>&, const _Tp&)): Turn into operator==(const optional<_Tp>&, const _Up&). (operator==(const _Tp&, const optional<_Tp>&)): Turn into operator==(const _Up&, const optional<_Tp>&). (operator!=(const optional<_Tp>&, const _Tp&)): Turn into operator!=(const optional<_Tp>&, const _Up&). (operator!=(const _Tp&, const optional<_Tp>&)): Turn into operator!=(const _Up&, const optional<_Tp>&). (operator<(const optional<_Tp>&, const _Tp&)): Turn into operator<(const optional<_Tp>&, const _Up&). (operator<(const _Tp&, const optional<_Tp>&)): Turn into operator<(const _Up&, const optional<_Tp>&). (operator>(const optional<_Tp>&, const _Tp&)): Turn into operator>(const optional<_Tp>&, const _Up&). (operator>(const _Tp&, const optional<_Tp>&)): Turn into operator>(const _Up&, const optional<_Tp>&). (operator<=(const optional<_Tp>&, const _Tp&)): Turn into operator<=(const optional<_Tp>&, const _Up&). (operator<=(const _Tp&, const optional<_Tp>&)): Turn into operator<=(const _Up&, const optional<_Tp>&). (operator>=(const optional<_Tp>&, const _Tp&)): Turn into operator>=(const optional<_Tp>&, const _Up&). (operator>=(const _Tp&, const optional<_Tp>&)): Turn into operator>=(const _Up&, const optional<_Tp>&). * testsuite/20_util/optional/relops/7.cc: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@246076 138bc75d-0d04-0410-961f-82ee72b054a4
2017-03-10P0604R0 add invoke_result, is_invocable etc. for C++17redi
* include/bits/invoke.h (__invoke): Use __invoke_result instead of result_of, and __is_nothrow_invocable instead of __is_nothrow_callable. * include/bits/shared_ptr_base.h (__shared_ptr): Use __is_invocable instead of __is_callable. * include/std/functional (invoke): use invoke_result_t instead of result_of_t and is_nothrow_invocable instead of is_nothrow_callable. (_Not_fn): Use __invoke_result instead of result_of. * include/std/type_traits (__result_of_memobj, __result_of_memfun): Remove partial specializations for reference_wrapper types. (__result_of_impl): Use __inv_unwrap to strip reference_wrapper. (__invoke_result): Define replacement for result_of and then use it to define result_of. (__is_callable_impl, __is_callable, __is_nothrow_callable): Replace with __is_invocable_impl, __is_invocable, and __is_nothrow_invocable respectively. (invoke_result, invoke_result_t): Define for C++17. (is_callable, is_nothrow_callable): Replace with is_invocable, is_invocable_r, is_nothrow_invocable, and is_nothrow_invocable_r. (is_callable_v, is_nothrow_callable_v): Replace with is_invocable_v, is_invocable_r_v, is_nothrow_invocable_v, and is_nothrow_invocable_r_v. * include/std/variant (hash<variant<T...>>): Use is_nothrow_invocable_v instead of is_nothrow_callable_v. * testsuite/20_util/function_objects/invoke/59768.cc: Remove unused main function. * testsuite/20_util/function_objects/not_fn/1.cc: Use is_invocable instead of is_callable. * testsuite/20_util/is_callable/*: Rename directory and adjust tests to use new traits. * testsuite/20_util/is_notjrow_callable/*: Likewise. * testsuite/20_util/optional/hash.cc: Use is_invocable_v instead of is_callable. * testsuite/20_util/variant/hash.cc: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@246036 138bc75d-0d04-0410-961f-82ee72b054a4
2017-03-09Define macro to simplify std::_Not_fn definitionredi
* include/std/functional (_Not_fn): Define macro to simplify repetitive function definitions. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@246013 138bc75d-0d04-0410-961f-82ee72b054a4
2017-03-05Add std::scoped_lock for C++17redi
* doc/xml/manual/status_cxx2017.xml: Document P0156R2 status. * doc/html/*: Regenerate. * include/std/mutex (scoped_lock): Implement new C++17 template. * testsuite/30_threads/scoped_lock/cons/1.cc: New test. * testsuite/30_threads/scoped_lock/requirements/ explicit_instantiation.cc: New test. * testsuite/30_threads/scoped_lock/requirements/typedefs.cc: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@245903 138bc75d-0d04-0410-961f-82ee72b054a4
2017-03-02PR libstdc++/79789 fix non-reserved names in headersredi
PR libstdc++/79789 * include/bits/hashtable_policy.h (__clp2): Use reserved names for parameters and local variables. * include/bits/ios_base.h (make_error_code, make_error_condition): Likewise. * include/bits/list.tcc (list::sort): Likewise. * include/bits/mask_array.h (mask_array): Likewise. * include/bits/regex.h (regex_token_iterator): Likewise. * include/bits/slice_array.h (slice_array): Likewise. * include/bits/stl_algo.h (__sample): Likewise. * include/std/memory (undeclare_no_pointers): Likewise. * include/std/type_traits (is_callable_v, is_nothrow_callable_v): Likewise. * libsupc++/exception_ptr.h (__dest_thunk): Likewise. * testsuite/17_intro/headers/names.cc: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@245828 138bc75d-0d04-0410-961f-82ee72b054a4
2017-03-02PR 79798 Fix incorrect use of std::result_of in std::bindredi
PR libstdc++/79798 * include/std/functional (bind::_Res_type_impl): Fix incorrect use of result_of that loses top-level cv-qualifiers. * testsuite/20_util/bind/79798.cc: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@245827 138bc75d-0d04-0410-961f-82ee72b054a4
2017-02-19C++17 GB50 resolution (P0505R0)redi
2017-02-19 Dinka Ranns <dinka.ranns@googlemail.com> C++17 GB50 resolution * include/std/chrono (duration::operator++()): Add _GLIBCXX17_CONSTEXPR. (duration::operator++(int)): Likewise. (duration::operator--()): Likewise. (duration::operator--(int)): Likewise. (duration::operator+=(const duration&)): Likewise. (duration::operator-=(const duration&)): Likewise. (duration::operator*=(const rep&)): Likewise. (duration::operator/=(const rep&)): Likewise. (duration::operator%=(const rep&)): Likewise. (duration::operator%=(const duration&)): Likewise. (time_point::operator+=(const duration&)): Likewise. (time_point::operator-=(const duration&)): Likewise. * testsuite/20_util/duration/arithmetic/constexpr_c++17.cc: New test. * testsuite/20_util/duration/literals/range.cc: Adjust dg-error. * testsuite/20_util/time_point/arithmetic/constexpr.cc: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@245575 138bc75d-0d04-0410-961f-82ee72b054a4
2017-02-15 PR libstdc++/78723timshen
* include/std/variant (operator<(), operator>(), operator<=(), operator>=(), operator==(), operator!=()): Implement P0393R3. * testsuite/20_util/variant/compile.cc: Adjust tests. * testsuite/20_util/variant/run.cc: Adjust tests. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@245475 138bc75d-0d04-0410-961f-82ee72b054a4
2017-02-15 PR libstdc++/79513timshen
* include/std/variant (visit()): Forward variant types to the return type detection code. * testsuite/20_util/variant/compile.cc: Add test cases. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@245474 138bc75d-0d04-0410-961f-82ee72b054a4
2017-02-13PR libstdc++/79486 use lvalues in result_of expressionsredi
PR libstdc++/79486 * include/std/future (__future_base::_Task_state::_M_run) (__future_base::_Task_state::_M_run_delayed): Use lvalue types in result_of expressions. * testsuite/30_threads/packaged_task/79486.cc: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@245386 138bc75d-0d04-0410-961f-82ee72b054a4
2017-01-30Implement LWG 2825, LWG 2756 breaks class template argument deduction for ↵ville
optional. * include/std/optional: Add a deduction guide. * testsuite/20_util/optional/cons/deduction_guide.cc: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@245024 138bc75d-0d04-0410-961f-82ee72b054a4
2017-01-26Fix namespace versioning and remove __detail::__identity helpersredi
PR libstdc++/79243 * include/bits/c++config (literals::string_view_literals::__7): Add. Only declare versioned namespaces for the relevant C++ dialects. * include/experimental/bits/erase_if.h (fundamentals_v2::__detail): Add versioning macros. * include/experimental/bits/lfts_config.h: (fundamentals_v1::__detail::__7, fundamentals_v2::__detail::__7): Add. * include/experimental/string_view (fundamentals_v2::__detail): Add versioning macros. (fundamentals_v2::__detail::__identity): Remove. (fundamentals_v2::__detail::__idt): Use common_type instead of __detail::__identity. * include/std/string_view (__detail::__identity, __detail::__idt): Likewise. (literals::string_view_literals): Fix nesting of versioning macros. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@244945 138bc75d-0d04-0410-961f-82ee72b054a4
2017-01-25PR libstdc++/70607 make proj(T) and conj(T) return complex<T>redi
PR libstdc++/61791 PR libstdc++/70607 * include/std/complex (real(T), imag(T)): Add _GLIBCXX_CONSTEXPR. (proj(T), conj(T)): Change return types per DR 1522. * include/tr1/complex (conj): Remove overloads and use std::conj. * testsuite/26_numerics/complex/dr781_dr1137.cc: Rename to... * testsuite/26_numerics/complex/dr781.cc: ... this, and update. * testsuite/26_numerics/complex/value_operations/constexpr2.cc: Test real(T) and imag(T). Allow testing for C++11 too. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@244900 138bc75d-0d04-0410-961f-82ee72b054a4
2017-01-24PR libstdc++/79206 check string_view sizes in operator==redi
PR libstdc++/79206 * include/experimental/string_view (operator==): Check sizes first. * include/std/string_view (operator==): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@244865 138bc75d-0d04-0410-961f-82ee72b054a4
2017-01-21Make poisoned hashes SFINAE away the call operator of the hash.ville
* include/bits/functional_hash.h (__poison_hash::__enable_hash_call): New. * include/std/optional (__optional_hash_call_base): New. (hash<optional<_Tp>>): Derive from the new base, move the hash function into that base. * include/std/variant (__variant_hash_call_base_impl): New. (__variant_hash_call_base): Likewise. (hash<variant<_Types...>>): Derive from the new base, move the hash function into that base. * testsuite/20_util/optional/hash.cc: Add tests for is_callable. * testsuite/20_util/variant/hash.cc: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@244748 138bc75d-0d04-0410-961f-82ee72b054a4