Commit Graph

9827 Commits

Author SHA1 Message Date
Jonathan Wakely
31ceab27a8 PR libstdc++/83427 detect weak result type from noexcept functions
PR libstdc++/83427
	* include/bits/refwrap.h (_Weak_result_type_impl)
	(_Reference_wrapper_base): Deduce noexcept for function types.
	* testsuite/20_util/bind/83427.cc: New test.
	* testsuite/20_util/reference_wrapper/83427.cc: New test.

From-SVN: r255652
2017-12-14 17:29:22 +00:00
Jonathan Wakely
3824ac481e PR libstdc++/59568 don't use putback or update value when extraction fails
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.

From-SVN: r255633
2017-12-14 11:53:02 +00:00
Jonathan Wakely
4fb43923ef PR libstdc++/83395 fix invocable traits for INVOKE<cv void>
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.

From-SVN: r255585
2017-12-12 18:07:24 +00:00
Jonathan Wakely
50748fad7c PR libstdc++/82522 overload map insert functions for rvalues (LWG 2354)
Backport from mainline
2017-10-13  Jonathan Wakely  <jwakely@redhat.com>

	PR libstdc++/82522
	* doc/xml/manual/intro.xml: Document LWG 2354 changes.
	* include/bits/stl_map.h (map::insert(value_type&&))
	(map::insert(const_iterator, value_type&&)): Add overload for rvalues.
	* include/bits/stl_multimap.h (multimap::insert(value_type&&))
	(multimap::insert(const_iterator, value_type&&)): Likewise.
	* include/bits/unordered_map.h (unordered_map::insert(value_type&&))
	(unordered_map::insert(const_iterator, value_type&&))
	(unordered_multimap::insert(value_type&&))
	(unordered_multimap::insert(const_iterator, value_type&&)): Likewise.
	* testsuite/23_containers/map/modifiers/insert/dr2354.cc: New test.
	* testsuite/23_containers/multimap/modifiers/insert/dr2354.cc: New
	test.
	* testsuite/23_containers/unordered_map/insert/dr2354.cc: New test.
	* testsuite/23_containers/unordered_multimap/insert/dr2354.cc: New
	test.

From-SVN: r255330
2017-12-01 17:50:59 +00:00
Jonathan Wakely
2a8f244b91 PR libstdc++/83134 Ensure std::__not_ converts B::value to bool
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.

From-SVN: r255329
2017-12-01 17:12:23 +00:00
Jonathan Wakely
526e9a2a50 Add noexcept to std::integral_constant members
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.

From-SVN: r255328
2017-12-01 17:12:18 +00:00
Jonathan Wakely
32d94e772e Add noexcept to std::shared_future copy operations (LWG DR 2799)
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).

From-SVN: r255327
2017-12-01 17:12:15 +00:00
Jonathan Wakely
c210258bae Add noexcept to generic std::size, std::empty and std::data
Backport from mainline
2017-11-15  Jonathan Wakely  <jwakely@redhat.com>

	* include/bits/range_access.h (size, empty, data): Add conditional
	noexcept to generic overloads.

From-SVN: r255326
2017-12-01 17:12:11 +00:00
Jonathan Wakely
e737fc0cba PR libstdc++/82685 add 'noexcept' to string_view literals
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.

From-SVN: r255325
2017-12-01 17:12:07 +00:00
Jonathan Wakely
c4e8c8d71c PR libstdc++/83226 avoid forming pointer-to-reference type
Backport from mainline
2017-11-30  Jonathan Wakely  <jwakely@redhat.com>

	PR libstdc++/83226
	* include/bits/node_handle.h (_Node_handle::__pointer): Avoid forming
	pointer-to-reference types.
	* testsuite/23_containers/map/modifiers/insert/83226.cc: New test.

From-SVN: r255324
2017-12-01 17:12:04 +00:00
Jonathan Wakely
54482a130a Fix typo in std::wbuffer_convert
Backport from mainline
2017-11-14  Jonathan Wakely  <jwakely@redhat.com>

	* include/bits/locale_conv.h (wbuffer_convert::_M_conv_get): Fix typo.
	* testsuite/22_locale/conversions/buffer/3.cc: New test.

From-SVN: r255323
2017-12-01 17:11:59 +00:00
Jonathan Wakely
051af3f55f Remove _Node_insert_return::get() member functions (P0508R0)
Backport from mainline
2017-11-03  Jonathan Wakely  <jwakely@redhat.com>

	* include/bits/node_handle.h (_Node_insert_return::get): Remove, as
	per P0508R0.

From-SVN: r255322
2017-12-01 17:11:55 +00:00
Jonathan Wakely
21197715b3 Update C++17 library status documentation
* doc/xml/manual/status_cxx1998.xml: Correct statement about
        what the doc covers.
        * doc/xml/manual/status_cxx2011.xml: Likewise.
        * doc/xml/manual/status_cxx2014.xml: Likewise.
	* doc/xml/manual/status_cxx2017.xml: Update C++17 status, and
	information on feature-test macros.
        * doc/xml/manual/status_cxxtr1.xml: Correct statement about what
        the doc covers.
        * doc/xml/manual/status_cxxtr24733.xml: Likewise.
	* doc/html/*: Regenerate.

From-SVN: r254080
2017-10-25 15:18:43 +01:00
Jonathan Wakely
032c672c5c PR libstdc++/81395 fix crash when write follows large read
Backport from mainline
2017-07-18  Jonathan Wakely  <jwakely@redhat.com>

	PR libstdc++/81395
	* include/bits/fstream.tcc (basic_filebuf::xsgetn): Don't set buffer
	pointers for write mode after reading.
	* testsuite/27_io/basic_filebuf/sgetn/char/81395.cc: New.

From-SVN: r254015
2017-10-23 18:16:38 +01:00
Jonathan Wakely
30be09e339 Fix invalid path::iterator test
* testsuite/experimental/filesystem/path/itr/traversal.cc: Do not
	increment past-the-end iterators.

From-SVN: r253968
2017-10-21 02:16:57 +01:00
Jonathan Wakely
dc0d363ff9 Update value of __cpp_lib_chrono feature-test macro
* 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.

From-SVN: r253960
2017-10-20 22:06:20 +01:00
Jonathan Wakely
37f7230a10 Define __cpp_lib_byte feature-test macro
* include/c_global/cstddef: Define __cpp_lib_byte feature-test macro.
	* testsuite/18_support/byte/requirements.cc: Check macro.

From-SVN: r253953
2017-10-20 19:19:09 +01:00
Jonathan Wakely
774310c50c PR libstdc++/82481 Suppress clang-tidy warnings
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.

From-SVN: r253944
2017-10-20 16:14:33 +01:00
Jonathan Wakely
7759a387e2 PR libstdc++/79433 no #error for including headers with wrong -std
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.

From-SVN: r253943
2017-10-20 16:14:29 +01:00
Jonathan Wakely
24aeb1b939 Fix path::iterator post-increment and post-decrement
Backport from mainline
2017-10-19  Jonathan Wakely  <jwakely@redhat.com>

	* include/experimental/bits/fs_path.h (path::iterator++(int))
	(path::iterator--(int)): Fix for paths with only one component.
	* testsuite/experimental/filesystem/path/itr/traversal.cc: Test
	post-increment and post-decrement.

From-SVN: r253942
2017-10-20 16:14:23 +01:00
Jonathan Wakely
6445b688e5 Fix tests for std::clamp
* testsuite/25_algorithms/clamp/1.cc: Fix order of arguments and
	expected results when using predicate defining reverse order.
	* testsuite/25_algorithms/clamp/constexpr.cc: Likewise.

From-SVN: r253053
2017-09-21 11:11:21 +01:00
Jonathan Wakely
7899221766 Fix libstdc++ testsuite failures with -D_GLIBCXX_USE_CXX11_ABI=0
Backport from mainline
2017-06-14  Jonathan Wakely  <jwakely@redhat.com>

	* doc/xml/manual/test.xml: Correct instructions on running tests.
	* testsuite/27_io/basic_ios/copyfmt/char/1.cc: Adjust to pass when
	-D_GLIBCXX_USE_CXX11_ABI=0 added to RUNTESTFLAGS.
	* testsuite/27_io/basic_ios/exceptions/char/1.cc: Likewise.
	* testsuite/27_io/basic_istream/extractors_arithmetic/char/
	exceptions_failbit.cc: Likewise.
	* testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/
	exceptions_failbit.cc: Likewise.
	* testsuite/27_io/basic_istream/extractors_other/char/
	exceptions_null.cc: Likewise.
	* testsuite/27_io/basic_istream/extractors_other/wchar_t/
	exceptions_null.cc: Likewise.
	* testsuite/27_io/basic_istream/sentry/char/12297.cc: Likewise.
	* testsuite/27_io/basic_istream/sentry/wchar_t/12297.cc: Likewise.
	* testsuite/27_io/basic_ostream/inserters_other/char/
	exceptions_null.cc: Likewise.
	* testsuite/27_io/basic_ostream/inserters_other/wchar_t/
	exceptions_null.cc: Likewise.
	* testsuite/27_io/ios_base/storage/2.cc: Likewise.

From-SVN: r253039
2017-09-20 23:26:26 +01:00
Jonathan Wakely
ae6af5239b PR libstdc++/79162 Fix std::string regression due to LWG 2946 (old ABI)
PR libstdc++/79162
	* include/bits/basic_string.h [!_GLIBCXX_USE_CXX11_ABI]
	(basic_string::_If_sv): Remove from the overload set when the
	argument is derived from basic_string.

From-SVN: r253038
2017-09-20 23:26:19 +01:00
Jonathan Wakely
094932a3c3 PR libstdc++/79162 Fix std::string regression due to LWG 2946
PR libstdc++/79162
	* include/bits/basic_string.h (basic_string::_If_sv): Remove from the
	overload set when the argument is derived from basic_string.
	* testsuite/21_strings/basic_string/cons/char/moveable2_c++17.cc: New
	test.
	* testsuite/21_strings/basic_string/cons/wchar_t/moveable2_c++17.cc:
	New test.

From-SVN: r253025
2017-09-20 19:52:56 +01:00
Jonathan Wakely
7ef7062dbc Fix failing C++17 test
* testsuite/24_iterators/range_access_cpp17.cc: Fix order of dg-do
	and dg-options directives. Fix invalid test.

From-SVN: r253020
2017-09-20 17:51:03 +01:00
Jonathan Wakely
6c8a90ba12 PR libstdc++/82262 fix std::hash<std::optional<const T>>
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>.

From-SVN: r253015
2017-09-20 15:22:29 +01:00
Jonathan Wakely
598c1fda3c PR libstdc++/82254 fix std::is_nothrow_invocable_r w.r.t throwing conversions
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.

From-SVN: r253014
2017-09-20 15:22:25 +01:00
Jonathan Wakely
12657787f9 PR libstdc++/79162 implement LWG 2946 and LWG 2758
Backport from mainline
2017-09-04  Daniel Kruegler  <daniel.kruegler@gmail.com>

	PR libstdc++/79162
	Implement LWG 2946, LWG 2758's resolution missed further corrections
	* include/bits/basic_string.h (basic_string::compare): Add missing
	required noexcept specifications.
	(basic_string): Introduce internal _S_to_string_view and __sv_wrapper
	for implicit string_view conversion.
	(basic_string::basic_string): Fix explicit string_view conversion by
	implicit conversion using _S_to_string_view and __sv_wrapper.
	(basic_string): Introduce internal basic_string(__sv_wrapper, Alloc)
	constructor.
	(basic_string): Fix operator=(T) template by operator=(const T&)
	template for uncopyable types (PR 79162).
	(basic_string::operator+=, basic_string::append, basic_string::assign)
	(basic_string::insert, basic_string::replace, basic_string::find)
	(basic_string::rfind, basic_string::find_first_of)
	(basic_string::find_last_of, basic_string::find_first_not_of)
	(basic_string::find_last_not_of, basic_string::compare): Replace
	__sv_type argument by template const T& (LWG 2946) and correct
	documentation describing __sv_type argument.
	(basic_string::find, basic_string::rfind, basic_string::find_first_of)
	(basic_string::find_last_of, basic_string::find_first_not_of)
	(basic_string::find_last_not_of, basic_string::compare): Replace
	unconditional noexcept specification by conditional noexcept
	specification to partially balance the removal of noexcept by LWG 2946.
	* testsuite/21_strings/basic_string/79162.cc: New.
	* testsuite/21_strings/basic_string/lwg2946.cc: New.

From-SVN: r252337
2017-09-13 17:38:47 +01:00
Jonathan Wakely
c2f99c9d9a PR libstdc++/81468 constrain std::chrono::time_point constructor
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.

From-SVN: r252090
2017-09-13 16:20:21 +01:00
Jonathan Wakely
61068cc174 Fix broken URLs in libstdc++ API docs
* doc/doxygen/mainpage.html: Fix broken URLs.

From-SVN: r252071
2017-09-13 11:22:35 +01:00
Jonathan Wakely
a9b45e7046 PR libstdc++/81835 fix broken URLs in libstdc++ docs
PR libstdc++/81835
	* doc/xml/manual/extensions.xml: Replace unstable URL.
	* doc/html/manual/ext_demangling.html: Regenerate.
	* libsupc++/cxxabi.h (__cxa_demangle): Fix broken URL.

From-SVN: r252067
2017-09-13 11:07:25 +01:00
Jonathan Wakely
e38bde5423 PR libstdc++/70483 make std::experimental::string_view fully constexpr
Backport from mainline
2017-09-12  Jonathan Wakely  <jwakely@redhat.com>

	PR libstdc++/70483
	* include/experimental/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/experimental/string_view (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, operator==, operator!=)
	(operator<, operator>, operator<=, operator>=): Likewise.
	* testsuite/experimental/string_view/operations/compare/char/70483.cc:
	New.

From-SVN: r252032
2017-09-12 17:27:14 +01:00
Jonathan Wakely
53e7178da5 PR libstdc++/70483 make std::string_view fully constexpr
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.

From-SVN: r252031
2017-09-12 17:27:09 +01:00
Jonathan Wakely
54316fafea Finish implementing P0426R1 "Constexpr for std::char_traits" for C++17
As discussed in PR c++/80265 ("__builtin_{memcmp,memchr,strlen} are
not usable in constexpr functions"), use __builtin_constant_p to tell
whether we can defer to a constexpr algorithm.

I used __always_inline__ just to be thorough.  It isn't really really
necessary as far as I could determine.

Changes like these:

	 if (__n == 0)
	   return 0;
 -	return wmemcmp(__s1, __s2, __n);
 +	else
 +	  return wmemcmp(__s1, __s2, __n);

are necessary otherwise G++ complains that we're calling a
non-constexpr function, which looks like a a manifestation of PR67026
to me.

libstdc++-v3:
2017-06-12  Pedro Alves  <palves@redhat.com>

	* doc/xml/manual/status_cxx2017.xml: Update C++17 constexpr
	char_traits status.
	* doc/html/*: Regenerate.

	* include/bits/char_traits.h (_GLIBCXX_ALWAYS_INLINE): Define if
	not already defined.
	(__cpp_lib_constexpr_char_traits): Uncomment.
	(__constant_string_p, __constant_char_array_p): New.
	(std::char_traits<char>, std::char_traits<wchar_t>): Add
	_GLIBCXX17_CONSTEXPR on compare, length and find and use
	__constant_string_p, __constant_char_array_p and
	__builtin_constant_p to defer to __gnu_cxx::char_traits at compile
	time.

	* testsuite/21_strings/char_traits/requirements/
	constexpr_functions_c++17.cc: Uncomment
	__cpp_lib_constexpr_char_traits tests.  Uncomment
	test_compare<char>, test_length<char>, test_find<char>,
	test_compare<wchar_t>, test_length<wchar_t> and test_find<wchar_t>
	static_assert tests.

From-SVN: r252030
2017-09-12 17:27:01 +01:00
Jonathan Wakely
c3c6d737b6 PR c++/82039 suppress -Wzero-as-null-pointer-constant warning
Backport from mainline
2017-08-31  Jonathan Wakely  <jwakely@redhat.com>

	PR c++/82039
	* include/ext/new_allocator.h (__gnu_cxx::new_allocator::allocate):
	Adjust null pointer constant to avoid warning.

From-SVN: r251658
2017-09-04 13:24:57 +01:00
Jonathan Wakely
b121ffed0a PR libstdc++/81912 make std::__iterator_category constexpr
Backport from mainline
2017-08-21  Jonathan Wakely  <jwakely@redhat.com>

	PR libstdc++/81912
	* include/bits/stl_iterator_base_types.h (__iterator_category): Add
	constexpr for C++11 and later.
	* testsuite/24_iterators/container_access.cc: Add target selector.
	* testsuite/24_iterators/range_access.cc: Fix clause number in
	comment.
	* testsuite/24_iterators/range_access_cpp14.cc: Likewise.
	* testsuite/24_iterators/range_access_cpp17.cc: New.

From-SVN: r251657
2017-09-04 13:24:53 +01:00
Jonathan Wakely
6e85190f97 Fix test for __has_unique_object_representations support in Clang
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.

From-SVN: r251656
2017-09-04 13:24:49 +01:00
Jonathan Wakely
ec5016c395 Fix test for __is_aggregate support in Clang
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.

From-SVN: r251655
2017-09-04 13:24:45 +01:00
Jonathan Wakely
c825961aa1 PR libstdc++/81891 fix double-free in hashtable constructor
Backport from mainline
2017-08-18  Jonathan Wakely  <jwakely@redhat.com>

	PR libstdc++/81891
	* include/bits/hashtable.h (_Hashtable(_InputIterator, _InputIterator,
	size_type, const _H1&, const _H2&, const _Hash&, const _Equal&,
	const _ExtractKey&, const allocator_type&)): Let destructor do clean
	up if an exception is thrown.
	* testsuite/23_containers/unordered_map/cons/81891.cc: New.

From-SVN: r251654
2017-09-04 13:24:42 +01:00
Jonathan Wakely
9584ad529f PR libstdc++/81599 fix typo in Doxygen comments
Backport from mainline
2017-07-31  Marek Polacek  <polacek@redhat.com>

	PR libstdc++/81599
	* include/bits/stl_stack.h: Fix typo.

From-SVN: r251653
2017-09-04 13:24:37 +01:00
Jonathan Wakely
16c067fa4a PR libstdc++/81338 correctly manage string capacity
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.

From-SVN: r251652
2017-09-04 13:24:33 +01:00
John David Anglin
2f9e7a343f re PR testsuite/81056 (FAIL: 17_intro/names.cc (test for excess errors))
PR testsuite/81056
	* testsuite/17_intro/names.cc: Undef 'd' and 'r' on __hpux__.

From-SVN: r251209
2017-08-20 19:00:59 +00:00
Jonathan Wakely
639c1cfb7d PR libstdc++/81751 don't call fflush(NULL)
Backport from mainline
2017-08-09  Jonathan Wakely  <jwakely@redhat.com>

	PR libstdc++/79820
	PR libstdc++/81751
	* config/io/basic_file_stdio.cc (sys_open(FILE*, ios_base::openmode)):
	Call fflush on the stream instead of calling sync() while _M_cfile is
	null. Restore original value of errno.
	* testsuite/ext/stdio_filebuf/char/79820.cc: New.
	* testsuite/ext/stdio_filebuf/char/81751.cc: New.

From-SVN: r251090
2017-08-14 13:14:09 +01:00
Jonathan Wakely
3cb1586fa2 PR libstdc++/53984 handle exceptions in basic_istream::sentry
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.

From-SVN: r251089
2017-08-14 13:14:01 +01:00
Richard Biener
586a0829dc Update ChangeLog and version files for release
From-SVN: r251081
2017-08-14 07:59:11 +00:00
Richard Biener
259828e6c7 Backport PRs 80721, 81175, 81410, 81455, 81505
2017-07-26  Richard Biener  <rguenther@suse.de>

	Backport from mainline
	2017-06-02  Richard Biener  <rguenther@suse.de>
		Markus Eisenmann  <meisenmann.lba@fh-salzburg.ac.at>

	PR libstdc++/80721
	* libsupc++/eh_alloc.cc (pool::free): Keep list properly
	sorted and add missing freelist item merging cases.

	2017-06-18  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/81410
	* tree-vect-stmts.c (vectorizable_load): Properly adjust for
	the gap in the ! slp_perm SLP case after each group.

	* gcc.dg/vect/pr81410.c: New testcase.

	2017-07-25  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/81455
	* tree-ssa-loop-unswitch.c (find_loop_guard): Make sure to
	not walk in cycles when looking for guards.

	* gcc.dg/pr81455.c: New testcase.

	2017-07-25  Richard Biener  <rguenther@suse.de>

	PR middle-end/81505
	* fold-const.c (fold_negate_const): TREE_OVERFLOW should be
	sticky.

	* gcc.dg/ubsan/pr81505.c: New testcase.

	2017-07-04  Jakub Jelinek  <jakub@redhat.com>

	PR target/81175
	* gcc.target/i386/pr69255-2.c (foo): Use the return value of the
	gather.

	2017-06-28  Jakub Jelinek  <jakub@redhat.com>

	PR target/81175
	* config/i386/i386.c (ix86_init_mmx_sse_builtins): Use def_builtin
	rather than def_builtin_pure for __builtin_ia32_gatherpf*.

	2017-06-26  Richard Biener  <rguenther@suse.de>

	PR target/81175
	* config/i386/i386.c (ix86_init_mmx_sse_builtins):
	Use def_builtin_pure for all gather builtins.

	* gfortran.dg/pr81175.f: New testcase.

	2017-06-21  Marc Glisse  <marc.glisse@inria.fr>
 
	* config/i386/i386.c (struct builtin_isa): New field pure_p.
	Reorder for compactness.
	(def_builtin, def_builtin2, ix86_add_new_builtins): Handle pure_p.
	(def_builtin_pure, def_builtin_pure2): New functions.
	(ix86_init_mmx_sse_builtins) [__builtin_ia32_stmxcsr]: Mark as pure.

 	* gcc.dg/tree-ssa/addadd.c: Un-XFAIL.
 	* gcc.dg/tree-ssa/addadd-2.c: New file.

From-SVN: r250560
2017-07-26 08:36:34 +00:00
Jonathan Wakely
371868a847 Support move-only deleters in std::shared_ptr (LWG 2802)
Backport from mainline
2017-06-09  Jonathan Wakely  <jwakely@redhat.com>

	* doc/xml/manual/intro.xml: Document LWG 2802, 2873 and 2942 changes.
	* include/bits/shared_ptr.h (shared_ptr): Use rvalues for deleters
	(LWG 2802).
	* include/bits/shared_ptr_base.h (_Sp_ebo_helper, _Sp_counted_deleter
	(_Sp_counted_deleter::_Impl, __shared_count, __shared_ptr): Likewise.
	* testsuite/20_util/shared_ptr/cons/lwg2802.cc: New.

From-SVN: r250541
2017-07-25 19:05:25 +01:00
Jonathan Wakely
dea4c7435c Add noexcept to shared_ptr owner comparisons (LWG 2873)
Backport from mainline
2017-06-05  Jonathan Wakely  <jwakely@redhat.com>

	* include/bits/shared_ptr_base.h (__shared_ptr::owner_before)
	(__weak_ptr::owner_before, _Sp_owner_less::operator()): Add noexcept
	specifiers as per LWG 2873 and LWG 2942.
	* testsuite/20_util/owner_less/noexcept.cc: New.
	* testsuite/20_util/shared_ptr/observers/owner_before.cc: Test
	noexcept guarantees.
	* testsuite/20_util/weak_ptr/observers/owner_before.cc: Likewise.

From-SVN: r250540
2017-07-25 19:05:19 +01:00
Jonathan Wakely
b65b227362 PR libstdc++/80553 don't allow destroying non-destructible types
Backport from mainline
2017-04-28  Jonathan Wakely  <jwakely@redhat.com>

	PR libstdc++/80553
	* include/bits/stl_construct.h (_Destroy, _Destroy_n): Add static
	assertions to ensure type is destructible.
	(destroy_at, destroy, destroy_n): Move from stl_uninitialized.h.
	* include/bits/stl_uninitialized.h (destroy_at, destroy, destroy_n):
	Move to stl_construct.h.
	* testsuite/20_util/specialized_algorithms/memory_management_tools/
	destroy_neg.cc: New test.
	* testsuite/23_containers/vector/cons/destructible_neg.cc: New test.

From-SVN: r250539
2017-07-25 19:05:13 +01:00
Jonathan Wakely
0182e8bb7b Implement std::experimental::source_location (N4519)
Backport from mainline
2017-05-16  Jonathan Wakely  <jwakely@redhat.com>

	* configure: Regenerate.
	* doc/xml/manual/status_cxx2017.xml: Update status table.
	* doc/html/*: Regenerate.
	* include/Makefile.am: Add new header.
	* include/Makefile.in: Regenerate.
	* include/experimental/source_location: New header implementing N4519.
	* testsuite/experimental/source_location/1.cc: New test.

From-SVN: r250538
2017-07-25 19:05:07 +01:00