Commit Graph

1134 Commits

Author SHA1 Message Date
Jonathan Wakely
96e0367ead PR libstdc++/83025 fix constraints for path overloads in <fstream>
PR libstdc++/83025
	* include/std/fstream (basic_filebuf::_If_path): Move to
	namespace-scope and rename to _If_fs_path.
	(basic_filebuf::open): Use new name.
	(basic_ifstream(_Path, ios::openmode))
	(basic_ifstream::open(_Path, ios::openmode))
	(basic_ofstream(_Path, ios::openmode))
	(basic_ofstream::open(_Path, ios::openmode))
	(basic_fstream(_Path, ios::openmode))
	(basic_fstream::open(_Path, ios::openmode)): Use _If_fs_path.
	* testsuite/27_io/basic_filebuf/open/char/path.cc: Test with filename
	as non-const char*.
	* testsuite/27_io/basic_fstream/cons/char/path.cc: Likewise.
	* testsuite/27_io/basic_fstream/open/char/path.cc: Likewise.
	* testsuite/27_io/basic_ifstream/cons/char/path.cc: Likewise.
	* testsuite/27_io/basic_ifstream/open/char/path.cc: Likewise.
	* testsuite/27_io/basic_ofstream/cons/char/path.cc: Likewise.
	* testsuite/27_io/basic_ofstream/open/char/path.cc: Likewise.

From-SVN: r254871
2017-11-17 14:07:58 +00:00
Jonathan Wakely
a930324dab Add noexcept to std::shared_future copy operations (LWG DR 2799)
* include/std/future (shared_future): Add noexcept to copy constructor
	and copy-assignment operator (LWG 2799).

From-SVN: r254821
2017-11-16 14:39:41 +00:00
Ville Voutilainen
865a86a0fd Fix gcd breakage.
* include/std/numeric (gcd): Use remove_cv_t, not remove_cv.

From-SVN: r254785
2017-11-15 22:42:58 +02:00
Ville Voutilainen
13545f19e0 Implement LWG 2733 and LWG 2759
* include/experimental/numeric (gcd): Reject cv-qualified bool.
(lcm): Likewise.
* include/std/numeric (gcd): Likewise.
(lcm): Likewise.
* testsuite/26_numerics/gcd/gcd_neg.cc: Add tests and adjust.
* testsuite/26_numerics/lcm/lcm_neg.cc: Likewise.

From-SVN: r254736
2017-11-14 20:11:33 +02:00
Jonathan Wakely
54df588530 PR libstdc++/82917 add missing returns in <fstream>
PR libstdc++/82917
	* include/std/fstream (basic_ifstream::open, basic_ofstream::open)
	(basic_fstream::open): Fix missing return.

From-SVN: r254638
2017-11-10 21:43:24 +00:00
Jonathan Wakely
e641ee437f Define std::endian for C++2a (P0463R1)
* include/std/type_traits (endian): Define new enumeration type.
	* testsuite/20_util/endian/1.cc: New test.

From-SVN: r254381
2017-11-03 15:45:49 +00:00
Jonathan Wakely
0a6e98b78b Remove ios_mode::trunc from basic_ofstream openmode arguments
* include/std/fstream (basic_ifstream, basic_ofstream, basic_fstream):
	Remove outdated comments about calling c_str() to create a file stream
	from a std::string.
	(basic_ofstream::basic_ofstream, basic_ofstream::open): Remove
	redundant ios_mode::trunc bits from default arguments and comments.

From-SVN: r254226
2017-10-30 15:35:02 +00:00
Jonathan Wakely
02a2c6303f Minor header reorganization for unordered containers
* include/bits/hashtable_policy.h: Include <tuple>.
	* include/std/unordered_map: Only include <bits/stl_pair.h> instead
	of <utility> and <tuple>.
	* include/std/unordered_set: Likewise.

From-SVN: r254223
2017-10-30 14:54:28 +00:00
Ville Voutilainen
ccbbf8df05 Implement LWG 2485
* include/debug/array (get(const array<_Tp, _Nm>&&)): New.
* include/std/array (get(const array<_Tp, _Nm>&&)): Likewise.
* include/std/tuple (get(const tuple<_Elements...>&&)): Likewise.
(get(const tuple<_Types...>&&)): Likewise.
* include/std/utility
(__pair_get::__const_move_get(const std::pair<_Tp1, _Tp2>&&)):
Likewise.
(get(const std::pair<_Tp1, _Tp2>&&)): Likewise.
(get(const pair<_Tp, _Up>&&)): Likewise.
(get(const pair<_Up, _Tp>&&)): Likewise.
* testsuite/20_util/pair/astuple/get.cc: Add tests for
new overloads.
* testsuite/20_util/pair/astuple/get_by_type.cc: Likewise.
* testsuite/20_util/tuple/element_access/get2.cc: Likewise.
* testsuite/20_util/tuple/element_access/get2_by_type.cc: Likewise.
* testsuite/23_containers/array/tuple_interface/get.cc: Likewise.
* testsuite/23_containers/array/tuple_interface/tuple_element_debug_neg.cc:
Adjust.
* testsuite/23_containers/array/tuple_interface/tuple_element_neg.cc:
Likewise.

From-SVN: r254222
2017-10-30 16:31:04 +02:00
Jonathan Wakely
d49f254a6c Provide filesystem::path overloads for file streams (LWG 2676, partial)
* include/std/fstream (basic_filebuf::_If_path): New SFINAE helper.
	(basic_filebuf::open<Path>(const Path&, const ios_base::openmode&))
	(basic_ifstream<Path>(const Path&, const ios_base::openmode&))
	(basic_ifstream::open<Path>(const Path&, const ios_base::openmode&))
	(basic_ofstream<Path>(const Path&, const ios_base::openmode&))
	(basic_ofstream::open<Path>(const Path&, const ios_base::openmode&))
	(basic_fstream<Path>(const Path&, const ios_base::openmode&))
	(basic_fstream::open<Path>(const Path&, const ios_base::openmode&)):
	New constructors and member functions.
	* testsuite/27_io/basic_filebuf/open/char/path.cc: New test.
	* testsuite/27_io/basic_fstream/cons/char/path.cc: New test.
	* testsuite/27_io/basic_fstream/open/char/path.cc: New test.
	* testsuite/27_io/basic_ifstream/cons/char/path.cc: New test.
	* testsuite/27_io/basic_ifstream/open/char/path.cc: New test.
	* testsuite/27_io/basic_ofstream/cons/char/path.cc: New test.
	* testsuite/27_io/basic_ofstream/open/char/path.cc: New test.

From-SVN: r254148
2017-10-27 13:39:01 +01:00
Jonathan Wakely
30e0aed183 PR libstdc++/82716 avoid stupid -Wmismatched-tags warnings
PR libstdc++/82716
	* include/std/array (tuple_size, tuple_element): Change class-key
	from class to struct, to avoid annoying Clang warnings.

From-SVN: r254077
2017-10-25 14:55:56 +01:00
Jonathan Wakely
02e2a7d8ef Refactor std::basic_string_view members and add noexcept
* include/bits/string_view.tcc (find_first_of, find_last_of)
	(find_first_not_of, find_last_not_of): Add noexcept.
	* include/std/string_view (basic_string_view(const _CharT*))
	(basic_string_view(const _CharT*, size_type))
	(front, back, remove_prefix, remove_suffix, find, rfind)
	(find_first_of, find_first_not_of): Add noexcept.
	(at(size_type), _S_compare(size_type, size_type)): Replace conditional
	expressions with if statements.
	(copy(_CharT*, size_type, size_type), substr(size_type, size_type)):
	Use _M_check for length checks.
	(compare(basic_string_view)): Reformat.
	(_M_check(size_type, const char)): Add noexcept(false).
	(_M_limit(size_type, size_type)): Use noexcept not _GLIBCXX_NOEXCEPT.

From-SVN: r254044
2017-10-24 14:18:52 +01:00
Jonathan Wakely
6a19d2a2ee PR libstdc++/82685 add 'noexcept' to string_view literals
PR libstdc++/82685
	* include/experimental/string_view (operator""sv): Add noexcept.
	* include/std/string_view (operator""sv): Likewise.

From-SVN: r254041
2017-10-24 12:28:40 +01:00
Jonathan Wakely
641cb5a675 Implement C++17 Filesystem library
Based on Filesystem TS implementation, with the changes applied by:

- P0219R1 Relative Paths for Filesystem
- P0317R1 Directory Entry Caching for Filesystem
- P0492R2 Resolution of C++17 National Body Comments

Where appropriate code is shared between the TS and C++17
implementations.

	* include/Makefile.am: Add new headers for C++17 filesystem library.
	* include/Makefile.in: Regenerate.
	* include/bits/fs_dir.h: New header, based on Filesystem TS code in
	include/experimental/bits directory.
	* include/bits/fs_fwd.h: Likewise.
	* include/bits/fs_ops.h: Likewise.
	* include/bits/fs_path.h: Likewise.
	* include/experimental/bits/fs_dir.h: Rename Doxygen group.
	* include/experimental/bits/fs_fwd.h: Likewise.
	* include/experimental/bits/fs_ops.h: Likewise.
	* include/experimental/bits/fs_path.h: Likewise.
	* include/experimental/filesystem (filesystem_error::_M_gen_what):
	Remove inline definition.
	* include/precompiled/stdc++.h: Add <filesystem> to precompiled
	header.
	* include/std/filesystem: New header.
	* python/libstdcxx/v6/printers.py: Enable printer for std::filesystem
	paths.
	* src/filesystem/Makefile.am: Add new files. Compile as C++17.
	* src/filesystem/Makefile.in: Regenerate.
	* src/filesystem/cow-dir.cc: Update comment.
	* src/filesystem/cow-ops.cc: Likewise.
	* src/filesystem/cow-path.cc: Likewise.
	* src/filesystem/cow-std-dir.cc: New file.
	* src/filesystem/cow-std-ops.cc: New file.
	* src/filesystem/cow-std-path.cc: New file.
	* src/filesystem/dir-common.h (_Dir_base, get_file_type): New header
	for common code.
	* src/filesystem/dir.cc (_Dir): Derive from _Dir_base.
	(open_dir): Move to _Dir_base constructor.
	(get_file_type): Move to dir-common.h.
	(recurse): Move to _Dir_base::should_recurse.
	* src/filesystem/ops-common.h: New header for common code.
	* src/filesystem/ops.cc (is_set, make_file_type, make_file_status)
	(is_not_found_errno, file_time, do_copy_file): Move to ops-common.h.
	* src/filesystem/path.cc (filesystem_error::_M_gen_what): Define.
	* src/filesystem/std-dir.cc: New file, based on Filesystem TS code.
	* src/filesystem/std-ops.cc: Likewise.
	* src/filesystem/std-dir.cc: Likewise.
	* testsuite/27_io/filesystem/iterators/directory_iterator.cc: New
	test.
	* testsuite/27_io/filesystem/iterators/pop.cc: New test.
	* testsuite/27_io/filesystem/iterators/recursive_directory_iterator.cc:
	New test.
	* testsuite/27_io/filesystem/operations/absolute.cc: New test.
	* testsuite/27_io/filesystem/operations/canonical.cc: New test.
	* testsuite/27_io/filesystem/operations/copy.cc: New test.
	* testsuite/27_io/filesystem/operations/copy_file.cc: New test.
	* testsuite/27_io/filesystem/operations/create_directories.cc: New
	test.
	* testsuite/27_io/filesystem/operations/create_directory.cc: New test.
	* testsuite/27_io/filesystem/operations/create_symlink.cc: New test.
	* testsuite/27_io/filesystem/operations/current_path.cc: New test.
	* testsuite/27_io/filesystem/operations/equivalent.cc: New test.
	* testsuite/27_io/filesystem/operations/exists.cc: New test.
	* testsuite/27_io/filesystem/operations/file_size.cc: New test.
	* testsuite/27_io/filesystem/operations/is_empty.cc: New test.
	* testsuite/27_io/filesystem/operations/last_write_time.cc: New test.
	* testsuite/27_io/filesystem/operations/permissions.cc: New test.
	* testsuite/27_io/filesystem/operations/proximate.cc: New test.
	* testsuite/27_io/filesystem/operations/read_symlink.cc: New test.
	* testsuite/27_io/filesystem/operations/relative.cc: New test.
	* testsuite/27_io/filesystem/operations/remove_all.cc: New test.
	* testsuite/27_io/filesystem/operations/space.cc: New test.
	* testsuite/27_io/filesystem/operations/status.cc: New test.
	* testsuite/27_io/filesystem/operations/symlink_status.cc: New test.
	* testsuite/27_io/filesystem/operations/temp_directory_path.cc: New
	test.
	* testsuite/27_io/filesystem/operations/weakly_canonical.cc: New test.
	* testsuite/27_io/filesystem/path/append/path.cc: New test.
	* testsuite/27_io/filesystem/path/assign/assign.cc: New test.
	* testsuite/27_io/filesystem/path/assign/copy.cc: New test.
	* testsuite/27_io/filesystem/path/compare/compare.cc: New test.
	* testsuite/27_io/filesystem/path/compare/path.cc: New test.
	* testsuite/27_io/filesystem/path/compare/strings.cc: New test.
	* testsuite/27_io/filesystem/path/concat/path.cc: New test.
	* testsuite/27_io/filesystem/path/concat/strings.cc: New test.
	* testsuite/27_io/filesystem/path/construct/copy.cc: New test.
	* testsuite/27_io/filesystem/path/construct/default.cc: New test.
	* testsuite/27_io/filesystem/path/construct/locale.cc: New test.
	* testsuite/27_io/filesystem/path/construct/range.cc: New test.
	* testsuite/27_io/filesystem/path/construct/string_view.cc: New test.
	* testsuite/27_io/filesystem/path/decompose/extension.cc: New test.
	* testsuite/27_io/filesystem/path/decompose/filename.cc: New test.
	* testsuite/27_io/filesystem/path/decompose/parent_path.cc: New test.
	* testsuite/27_io/filesystem/path/decompose/relative_path.cc: New
	test.
	* testsuite/27_io/filesystem/path/decompose/root_directory.cc: New
	test.
	* testsuite/27_io/filesystem/path/decompose/root_name.cc: New test.
	* testsuite/27_io/filesystem/path/decompose/root_path.cc: New test.
	* testsuite/27_io/filesystem/path/decompose/stem.cc: New test.
	* testsuite/27_io/filesystem/path/generation/normal.cc: New test.
	* testsuite/27_io/filesystem/path/generation/proximate.cc: New test.
	* testsuite/27_io/filesystem/path/generation/relative.cc: New test.
	* testsuite/27_io/filesystem/path/generic/generic_string.cc: New test.
	* testsuite/27_io/filesystem/path/itr/traversal.cc: New test.
	* testsuite/27_io/filesystem/path/modifiers/clear.cc: New test.
	* testsuite/27_io/filesystem/path/modifiers/make_preferred.cc: New
	test.
	* testsuite/27_io/filesystem/path/modifiers/remove_filename.cc: New
	test.
	* testsuite/27_io/filesystem/path/modifiers/replace_extension.cc: New
	test.
	* testsuite/27_io/filesystem/path/modifiers/replace_filename.cc: New
	test.
	* testsuite/27_io/filesystem/path/modifiers/swap.cc: New test.
	* testsuite/27_io/filesystem/path/native/string.cc: New test.
	* testsuite/27_io/filesystem/path/nonmember/hash_value.cc: New test.
	* testsuite/27_io/filesystem/path/query/empty.cc: New test.
	* testsuite/27_io/filesystem/path/query/has_extension.cc: New test.
	* testsuite/27_io/filesystem/path/query/has_filename.cc: New test.
	* testsuite/27_io/filesystem/path/query/has_parent_path.cc: New test.
	* testsuite/27_io/filesystem/path/query/has_relative_path.cc: New
	test.
	* testsuite/27_io/filesystem/path/query/has_root_directory.cc: New
	test.
	* testsuite/27_io/filesystem/path/query/has_root_name.cc: New test.
	* testsuite/27_io/filesystem/path/query/has_root_path.cc: New test.
	* testsuite/27_io/filesystem/path/query/has_stem.cc: New test.
	* testsuite/27_io/filesystem/path/query/is_relative.cc: New test.
	* testsuite/experimental/filesystem/path/construct/string_view.cc:
	Define USE_FILESYSTEM_TS.
	* testsuite/util/testsuite_fs.h: Allow use with C++17 paths as well
	as Filesystem TS.

From-SVN: r254008
2017-10-23 13:11:22 +01:00
Jonathan Wakely
233fa165ad 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: r253959
2017-10-20 22:05:11 +01:00
Jonathan Wakely
d1e85aa999 PR libstdc++/82481 Suppress clang-tidy warnings
PR libstdc++/82481
	* include/std/mutex (call_once): Suppress clang-tidy warnings about
	dangling references.

From-SVN: r253724
2017-10-13 13:39:24 +01:00
Jakub Jelinek
9a741aee62 charconv (__unsigned_least_t): Fix number of closing >s for !_GLIBCXX_USE_INT128.
* include/std/charconv (__unsigned_least_t): Fix number of closing >s for
	!_GLIBCXX_USE_INT128.

From-SVN: r253371
2017-10-03 01:28:54 +02:00
Jonathan Wakely
804b7cc438 C++17 P0067R5 std::to_chars and std::from_chars (partial)
This adds the integral overloads of std::to_chars and std::from_chars,
including the changes made by P0682R0. Support for floating point types
is absent.

	* include/Makefile.am: Add new <charconv> header.
	* include/Makefile.in: Regenerate.
	* include/precompiled/stdc++.h: Include <charconv>.
	* include/std/charconv: New file.
	(to_chars_result, to_chars, from_chars_result, from_chars): Define.
	* testsuite/20_util/from_chars/1.cc: New test.
	* testsuite/20_util/from_chars/1_neg.cc: New test.
	* testsuite/20_util/from_chars/2.cc: New test.
	* testsuite/20_util/from_chars/requirements.cc: New test.
	* testsuite/20_util/to_chars/1.cc: New test.
	* testsuite/20_util/to_chars/1_neg.cc: New test.
	* testsuite/20_util/to_chars/2.cc: New test.
	* testsuite/20_util/to_chars/requirements.cc: New test.

From-SVN: r253353
2017-10-02 15:06:40 +01:00
Jonathan Wakely
f78958c9b4 Deprecate nested types in std::hash
* include/bits/c++config (_GLIBCXX17_DEPRECATED): Define.
	* include/bits/functional_hash.h (__hash_base::result_type)
	(__hash_base::argument_type): Add _GLIBCXX17_DEPRECATED.
	* include/std/optional (hash<optional<T>>::result_type)
	(hash<optional<T>>::argument_type): Add deprecated attribute.
	(__is_fast_hash<hash<optional<T>>>): Add partial specialization.
	* include/std/variant (hash<variant<Types...>>::result_type)
	(hash<variant<Types...>>::argument_type): Add deprecated attribute.
	(__is_fast_hash<hash<variant<Types...>>>): Add partial specialization.

From-SVN: r253017
2017-09-20 17:34:42 +01:00
Jonathan Wakely
f6b05c44aa 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: r253010
2017-09-20 14:24:45 +01:00
Jonathan Wakely
c4b06e7f1d 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: r252977
2017-09-19 15:33:51 +01:00
Jonathan Wakely
db624b3b4b Use built-in for std::make_integer_sequnce
* include/std/utility (_Itup_cat, _Make_integer_sequence): Remove.
	(_Build_index_tuple, make_integer_sequence): Use built-in to generate
	pack expansion.

From-SVN: r252923
2017-09-18 13:02:19 +01:00
Jonathan Wakely
ec26ff5a01 PR libstdc++/71187 reimplement declval without add_rvalue_reference
PR libstdc++/71187
	* include/std/type_traits (__declval): New function to deduce return
	type of declval.
	(__declval_protector::_delegate): Remove.
	(declval): Use __declval instead of add_rvalue_reference and
	__declval_protector::__delegate.
	* testsuite/20_util/declval/requirements/1_neg.cc: Adjust dg-error
	lineno.
	* testsuite/20_util/make_signed/requirements/typedefs_neg.cc:
	Likewise.
	* testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc:
	Likewise.

From-SVN: r252922
2017-09-18 12:40:10 +01:00
Jonathan Wakely
d0dda80415 PR libstdc++/81468 constrain std::chrono::time_point constructor
PR libstdc++/81468
	* include/std/chrono (__enable_if_is_duration)
	(__disable_if_is_duration): New alias templates to simplify SFINAE.
	(duration_cast, floor, ceil): Use __enable_if_is_duration.
	(duration::__is_float, duration::__is_harmonic): New alias templates
	to simplify SFINAE.
	(duration::duration(const _Rep2&)): Use _Require, __is_float and
	__is_harmonic.
	(duration::duration(const duration<_Rep2, _Period2>&)): Likewise.
	(__common_rep_type): Remove, replace with ...
	(__common_rep_t): New alias template.
	(operator*, operator/, operator%): Use __common_rep_t and
	__disable_if_is_duration.
	(time_point::time_point(const time_point<clock, _Dur2>&)): Add missing
	constraint from LWG DR 1177.
	* testsuite/20_util/duration/cons/dr1177.cc: New.
	* testsuite/20_util/duration/literals/range.cc: Update dg-error line.
	* testsuite/20_util/duration/requirements/typedefs_neg1.cc: Likewise.
	* testsuite/20_util/duration/requirements/typedefs_neg2.cc: Likewise.
	* testsuite/20_util/duration/requirements/typedefs_neg3.cc: Likewise.
	* testsuite/20_util/time_point/cons/81468.cc: New.

From-SVN: r252085
2017-09-13 15:07:44 +01:00
Jonathan Wakely
c6888c6257 PR libstdc++/79433 no #error for including headers with wrong -std
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: r252018
2017-09-12 15:02:59 +01:00
Jonathan Wakely
c5ae1a27bd PR libstdc++/70483 make std::string_view fully constexpr
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: r251988
2017-09-11 22:47:41 +01:00
Jonathan Wakely
2d763763ed Fix test for __has_unique_object_representations support in Clang
* 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: r251009
2017-08-09 22:38:05 +01:00
Katsuhiko Nishimra
2ae804bf9d Fix test for __is_aggregate support in Clang
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: r251008
2017-08-09 22:37:52 +01:00
Jonathan Wakely
c2830789ba PR libstdc++/53984 handle exceptions in basic_istream::sentry
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: r250545
2017-07-25 21:36:06 +01:00
Jonathan Wakely
a74bc411bc Remove deprecated iostream members for C++17
* include/bits/ios_base.h (ios_base::io_state, ios_base::open_mode)
	(ios_base::seek_dir): Remove for C++17.
	* include/std/streambuf (basic_streambuf::stossc): Remove for C++17.
	Add deprecated attribute for C++11 and C++14.
	* testsuite/27_io/types/1.cc: Don't run for C++17 and later.
	* testsuite/27_io/types/4.cc: New.

From-SVN: r250531
2017-07-25 18:47:52 +01:00
François Dumont
4a15d84228 re PR libstdc++/81064 (Inline namespace regression)
2017-07-23  François Dumont  <fdumont@gcc.gnu.org>

	PR libstdc++/81064
	* include/bits/algorithmfwd.h: Reorganize versioned namespace.
	* include/bits/basic_string.h: Likewise.
	* include/bits/c++config: Likewise.
	* include/bits/deque.tcc: Likewise.
	* include/bits/forward_list.h: Likewise.
	* include/bits/forward_list.tcc: Likewise.
	* include/bits/hashtable_policy.h: Likewise.
	* include/bits/list.tcc: Likewise.
	* include/bits/move.h: Likewise.
	* include/bits/quoted_string.h: Likewise.
	* include/bits/random.h: Likewise.
	* include/bits/random.tcc: Likewise.
	* include/bits/regex.h: Likewise.
	* include/bits/regex.tcc: Likewise.
	* include/bits/regex_automaton.h: Likewise.
	* include/bits/regex_automaton.tcc: Likewise.
	* include/bits/regex_compiler.h: Likewise.
	* include/bits/regex_compiler.tcc: Likewise.
	* include/bits/regex_constants.h: Likewise.
	* include/bits/regex_error.h: Likewise.
	* include/bits/regex_executor.h: Likewise.
	* include/bits/regex_executor.tcc: Likewise.
	* include/bits/regex_scanner.h: Likewise.
	* include/bits/regex_scanner.tcc: Likewise.
	* include/bits/specfun.h: Likewise.
	* include/bits/stl_algo.h: Likewise.
	* include/bits/stl_algobase.h: Likewise.
	* include/bits/stl_bvector.h: Likewise.
	* include/bits/stl_deque.h: Likewise.
	* include/bits/stl_iterator.h: Likewise.
	* include/bits/stl_iterator_base_funcs.h: Likewise.
	* include/bits/stl_list.h: Likewise.
	* include/bits/stl_map.h: Likewise.
	* include/bits/stl_multimap.h: Likewise.
	* include/bits/stl_multiset.h: Likewise.
	* include/bits/stl_relops.h: Likewise.
	* include/bits/stl_set.h: Likewise.
	* include/bits/stl_vector.h: Likewise.
	* include/bits/uniform_int_dist.h: Likewise.
	* include/bits/unordered_map.h: Likewise.
	* include/bits/unordered_set.h: Likewise.
	* include/bits/vector.tcc: Likewise.
	* include/c_global/cmath: Likewise.
	* include/c_std/cmath: Likewise.
	* include/decimal/decimal: Likewise.
	* include/decimal/decimal.h: Likewise.
	* include/experimental/algorithm: Likewise.
	* include/experimental/any: Likewise.
	* include/experimental/array: Likewise.
	* include/experimental/bits/erase_if.h: Likewise.
	* include/experimental/bits/fs_dir.h: Likewise.
	* include/experimental/bits/fs_fwd.h: Likewise.
	* include/experimental/bits/fs_ops.h: Likewise.
	* include/experimental/bits/fs_path.h: Likewise.
	* include/experimental/bits/lfts_config.h: Likewise.
	* include/experimental/bits/shared_ptr.h: Likewise.
	* include/experimental/bits/string_view.tcc: Likewise.
	* include/experimental/chrono: Likewise.
	* include/experimental/deque: Likewise.
	* include/experimental/filesystem: Likewise.
	* include/experimental/forward_list: Likewise.
	* include/experimental/functional: Likewise.
	* include/experimental/iterator: Likewise.
	* include/experimental/list: Likewise.
	* include/experimental/map: Likewise.
	* include/experimental/memory: Likewise.
	* include/experimental/memory_resource: Likewise.
	* include/experimental/numeric: Likewise.
	* include/experimental/optional: Likewise.
	* include/experimental/propagate_const: Likewise.
	* include/experimental/random: Likewise.
	* include/experimental/ratio: Likewise.
	* include/experimental/regex: Likewise.
	* include/experimental/set: Likewise.
	* include/experimental/source_location: Likewise.
	* include/experimental/string: Likewise.
	* include/experimental/string_view: Likewise.
	* include/experimental/system_error: Likewise.
	* include/experimental/tuple: Likewise.
	* include/experimental/type_traits: Likewise.
	* include/experimental/unordered_map: Likewise.
	* include/experimental/unordered_set: Likewise.
	* include/experimental/utility: Likewise.
	* include/experimental/vector: Likewise.
	* include/ext/bitmap_allocator.h: Likewise.
	* include/ext/codecvt_specializations.h: Likewise.
	* include/ext/rope: Likewise.
	* include/ext/typelist.h: Likewise.
	* include/std/chrono: Likewise.
	* include/std/complex: Likewise.
	* include/std/functional: Likewise.
	* include/std/numeric: Likewise.
	* include/std/string_view: Likewise.
	* include/std/thread: Likewise.
	* include/std/variant: Likewise.
	* include/tr1/array: Likewise.
	* include/tr1/bessel_function.tcc: Likewise.
	* include/tr1/beta_function.tcc: Likewise.
	* include/tr1/cmath: Likewise.
	* include/tr1/complex: Likewise.
	* include/tr1/ell_integral.tcc: Likewise.
	* include/tr1/exp_integral.tcc: Likewise.
	* include/tr1/functional: Likewise.
	* include/tr1/functional_hash.h: Likewise.
	* include/tr1/gamma.tcc: Likewise.
	* include/tr1/hashtable.h: Likewise.
	* include/tr1/hashtable_policy.h: Likewise.
	* include/tr1/hypergeometric.tcc: Likewise.
	* include/tr1/legendre_function.tcc: Likewise.
	* include/tr1/modified_bessel_func.tcc: Likewise.
	* include/tr1/poly_hermite.tcc: Likewise.
	* include/tr1/poly_laguerre.tcc: Likewise.
	* include/tr1/random.h: Likewise.
	* include/tr1/random.tcc: Likewise.
	* include/tr1/regex: Likewise.
	* include/tr1/riemann_zeta.tcc: Likewise.
	* include/tr1/shared_ptr.h: Likewise.
	* include/tr1/special_function_util.h: Likewise.
	* include/tr1/tuple: Likewise.
	* include/tr1/type_traits: Likewise.
	* include/tr1/unordered_map.h: Likewise.
	* include/tr1/unordered_set.h: Likewise.
	* include/tr1/utility: Likewise.
	* include/tr2/bool_set: Likewise.
	* include/tr2/bool_set.tcc: Likewise.
	* include/tr2/dynamic_bitset: Likewise.
	* include/tr2/dynamic_bitset.tcc: Likewise.
	* include/tr2/ratio: Likewise.
	* include/tr2/type_traits: Likewise.
	* src/c++11/chrono.cc: Likewise.
	* src/c++11/compatibility-c++0x.cc: Likewise.
	* src/c++11/compatibility-chrono.cc: Likewise.
	* src/c++11/cxx11-shim_facets.cc: Likewise.
	* src/c++11/hashtable_c++0x.cc: Likewise.
	* src/c++11/placeholders.cc: Likewise.
	* src/c++11/thread.cc: Likewise.
	* src/c++98/bitmap_allocator.cc: Likewise.
	* src/c++98/hashtable_tr1.cc: Likewise.
	* src/c++98/list.cc: Likewise.
	* src/shared/hashtable-aux.cc: Likewise.
	* testsuite/20_util/duration/literals/range.cc: Adapt line number.
	* testsuite/20_util/duration/requirements/typedefs_neg1.cc: Likewise.
	* testsuite/20_util/duration/requirements/typedefs_neg2.cc: Likewise.
	* testsuite/20_util/duration/requirements/typedefs_neg3.cc: Likewise.
	* testsuite/20_util/forward/c_neg.cc: Likewise.
	* testsuite/20_util/forward/f_neg.cc: Likewise.
	* testsuite/26_numerics/gcd/gcd_neg.cc: Likewise.
	* testsuite/26_numerics/lcm/lcm_neg.cc: Likewise.
	* testsuite/26_numerics/random/pr60037-neg.cc: Likewise.
	* python/libstdcxx/v6/printers.py: Adapt.

From-SVN: r250458
2017-07-23 08:41:35 +00:00
Jonathan Wakely
e12d3780e6 Reorder std::scoped_lock parameters as per P0739R0 DR status
* 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.

From-SVN: r250223
2017-07-15 16:43:22 +01:00
Jason Merrill
20316b9b2e Constrain std::variant constructor for class template argument deduction
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.

Co-Authored-By: Jonathan Wakely <jwakely@redhat.com>

From-SVN: r250213
2017-07-14 20:13:49 +01:00
Jonathan Wakely
387c17d312 PR libstdc++/81381 support stateful allocators in basic_stringbuf
PR libstdc++/81381
	* include/bits/sstream.tcc (basic_stringbuf::overflow)
	(basic_stringbuf::basic_stringbuf(const __string_type&, ios::mode))
	(basic_stringbuf::str()): Construct new strings with an allocator.
	* testsuite/27_io/basic_stringbuf/cons/81381.cc: New.

From-SVN: r250101
2017-07-10 18:59:02 +01:00
Jonathan Wakely
93ef155b3d PR libstdc++/81338 correctly manage string capacity
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: r250100
2017-07-10 18:58:56 +01:00
Tim Shen
7050372474 re PR libstdc++/80187 (C++ variant should be trivially copy constructible if possible)
PR libstdc++/80187
	* include/std/variant (variant::variant, variant::~variant,
	variant::operator=): Implement triviality forwarding for four
	special member functions.
	* testsuite/20_util/variant/compile.cc: Tests.

From-SVN: r249706
2017-06-27 18:19:03 +00:00
Ville Voutilainen
5e88d2d08d 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.

From-SVN: r249468
2017-06-21 22:53:26 +03:00
Jonathan Wakely
94895bd98d PR libstdc++/80939 Remove unmeetable constexpr specifiers
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.

From-SVN: r248881
2017-06-05 17:49:04 +01:00
Tim Shen
a8127c0cca re PR c++/80737 (variant<any> as class member resulting to compile errors)
PR libstdc++/80737
  * include/std/variant(variant::variant): SFINAE on is_same first.
  * testsuite/20_util/variant/any.cc: test case.

From-SVN: r248548
2017-05-28 21:27:30 +00:00
Jonathan Wakely
747217d179 PR libstdc++/80478 make std::mem_fn work with noexcept functions
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.

From-SVN: r248245
2017-05-18 18:32:06 +01:00
Jonathan Wakely
26bddba34a Fixes to Doxygen comments in libstdc++ headers
* include/bits/refwrap.h: Fix Doxygen warning.
	* include/bits/specfun.h: Likewise.
	* include/bits/std_function.h: Likewise.
	* include/bits/stl_algo.h (set_union, set_intersection)
	(set_difference, set_symmetric_difference): Add Doxygen @param tags
	for output iterator parameters.
	* include/bits/stl_iterator.h (inserter): Add Doxygen @param tag for
	iterator parameter.
	* include/std/mutex (try_lock, lock): Change Mutex to Lockable in
	Doxygen comments.

From-SVN: r248160
2017-05-17 17:02:33 +01:00
Ville Voutilainen
b42cc3ca24 Implement new C++ intrinsics __is_assignable and __is_constructible.
c-family/

Implement new C++ intrinsics __is_assignable and __is_constructible.
* c-common.c (__is_assignable, __is_constructible): New.
* c-common.h (RID_IS_ASSIGNABLE, RID_IS_CONSTRUCTIBLE): Likewise.

cp/

PR c++/80654
PR c++/80682
Implement new C++ intrinsics __is_assignable and __is_constructible.
* cp-tree.h (CPTK_IS_ASSIGNABLE, CPTK_IS_CONSTRUCTIBLE): New.
(is_xible): New.
* cxx-pretty-print.c (pp_cxx_trait_expression): Handle
CPTK_IS_ASSIGNABLE and CPTK_IS_CONSTRUCTIBLE.
* method.c (constructible_expr): Set cp_unevaluated.
(is_xible_helper): New.
(is_trivially_xible): Adjust.
(is_xible): New.
* parser.c (cp_parser_primary_expression): Handle
RID_IS_ASSIGNABLE and RID_IS_CONSTRUCTIBLE.
(cp_parser_trait_expr): Likewise.
* semantics.c (trait_expr_value): Handle
CPTK_IS_ASSIGNABLE and CPTK_IS_CONSTRUCTIBLE.

testsuite/

* g++.dg/ext/80654.C: New.

libstdc++-v3/

Implement new C++ intrinsics __is_assignable and __is_constructible.
* include/std/type_traits (__do_is_static_castable_impl): Remove.
(__is_static_castable_impl, __is_static_castable_safe): Likewise.
(__is_static_castable, __do_is_direct_constructible_impl): Likewise.
(__is_direct_constructible_impl): Likewise.
(__is_direct_constructible_new_safe): Likewise.
(__is_base_to_derived_ref, __is_lvalue_to_rvalue_ref): Likewise.
(__is_direct_constructible_ref_cast): Likewise.
(__is_direct_constructible_new, __is_direct_constructible): Likewise.
(__do_is_nary_constructible_impl): Likewise.
(__is_nary_constructible_impl, __is_nary_constructible): Likewise.
(__is_constructible_impl): Likewise.
(is_constructible): Call the intrinsic.
(__is_assignable_helper): Remove.
(is_assignable): Call the intrinsic.
(is_trivially_constructible): Likewise.
(__is_trivially_copy_constructible_impl): New.
(is_trivially_copy_constructible): Use it.
(__is_trivially_move_constructible_impl): New.
(is_trivially_move_constructible): Use it.
(is_trivially_assignable): Call the intrinsic.
(__is_trivially_copy_assignable_impl): New.
(is_trivially_copy_assignable): Use it.
(__is_trivially_move_assignable_impl): New.
(is_trivially_move_assignable): Use it.
(testsuite/20_util/declval/requirements/1_neg.cc): Adjust.
(testsuite/20_util/is_trivially_copy_assignable/value.cc):
Add test for void.
(testsuite/20_util/is_trivially_copy_constructible/value.cc): Likewise.
(testsuite/20_util/is_trivially_move_assignable/value.cc): Likewise.
(testsuite/20_util/is_trivially_move_constructible/value.cc): Likewise.
(testsuite/20_util/make_signed/requirements/typedefs_neg.cc): Adjust.
(testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc):
Likewise.

From-SVN: r248153
2017-05-17 16:54:23 +03:00
Marc Glisse
2c27a627a3 optional (_Optional_base::_M_get): Check precondition.
2017-05-16  Marc Glisse  <marc.glisse@inria.fr>

	* include/std/optional (_Optional_base::_M_get): Check precondition.
	* testsuite/20_util/optional/cons/value_neg.cc: Update line numbers.

From-SVN: r248099
2017-05-16 12:54:16 +00:00
Jonathan Wakely
f859f912e4 PR libstdc++/78939 make tuple_size<cv T> depend on tuple_size<T>
PR libstdc++/78939
	* include/std/utility (tuple_size<cv T>): Only define partial
	specializations when tuple_size<T>::value is valid.
	* testsuite/20_util/tuple/78939.cc: New.
	* testsuite/20_util/tuple/cv_tuple_size_neg.cc: New.

From-SVN: r247973
2017-05-12 15:43:11 +01:00
François Dumont
87c7063d68 Bump version namespace.
2017-05-10  François Dumont  <fdumont@gcc.gnu.org>

	Bump version namespace.
	* config/abi/pre/gnu-versioned-namespace.ver: Bump version namespace
	from __7 to __8. Bump GLIBCXX_7.0 to GLIBCXX_8.0.
	* acinclude.m4 (libtool_VERSION): Bump to 8:0:0.
	* include/bits/c++config: Adapt.
	* include/bits/regex.h: Adapt.
	* include/experimental/bits/fs_fwd.h: Adapt.
	* include/experimental/bits/lfts_config.h: Adapt.
	* include/std/variant: Adapt.
	* python/libstdcxx/v6/printers.py: Adapt.
	* testsuite/libstdc++-prettyprinters/48362.cc: Adapt.
	* include/bits/stl_tree.h (_Rb_tree_impl<>): Remove _Is_pod_comparator
	template parameter when version namespace is active.

From-SVN: r247858
2017-05-10 20:40:28 +00:00
Jonathan Wakely
9057edd30c Tweak static assertions in std::optional
* include/std/optional: Use a separate static_assert per condition.
	* testsuite/20_util/optional/cons/value_neg.cc: Update dg-error line
	numbers.

From-SVN: r247748
2017-05-08 18:13:38 +01:00
Jonathan Wakely
946ecd6ab2 PR libstdc++/80316 make promise::set_value throw no_state error
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.

From-SVN: r247064
2017-04-21 15:49:19 +01:00
Jonathan Wakely
1b36f6036e PR79862 check macro for type aliases that depend on <stdint.h>
PR libstdc++/79862
	* include/std/atomic [!_GLIBCXX_USE_C99_STDINT_TR1] (atomic_int8_t)
	(atomic_uint8_t, atomic_int16_t, atomic_uint16_t, atomic_int32_t,
	(atomic_uint32_t, atomic_int64_t, atomic_uint64_t)
	(atomic_int_least8_t, atomic_uint_least8_t, atomic_int_least16_t)
	(atomic_uint_least16_t, atomic_int_least32_t, atomic_uint_least32_t)
	(atomic_int_least64_t, atomic_uint_least64_t, atomic_int_fast8_t)
	(atomic_uint_fast8_t, atomic_int_fast16_t, atomic_uint_fast16_t)
	(atomic_int_fast32_t, atomic_uint_fast32_t, atomic_int_fast64_t)
	(atomic_uint_fast64_t, atomic_intmax_t, atomic_uintmax_t): Don't
	define.

From-SVN: r247021
2017-04-20 14:04:28 +01:00
Jonathan Wakely
afa56c1751 PR libstdc++/80446 cope with libc defining __has_builtin
PR libstdc++/80446
	* include/std/type_traits (is_aggregate): Change __has_builtin checks.
	* libsupc++/new (launder): Likewise.

From-SVN: r246992
2017-04-19 11:49:12 +01:00
Jonathan Wakely
38d68cf0f5 Fix incorrect results from std::boyer_moore_searcher
* 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.

From-SVN: r246964
2017-04-18 12:08:00 +01:00