Commit Graph

206 Commits

Author SHA1 Message Date
Jonathan Wakely 16d0ab7f44 Add missing header for std::max_align_t
* include/experimental/memory_resource: Include <cstddef> header.

From-SVN: r262977
2018-07-25 18:24:49 +01:00
Jonathan Wakely 7a4be38049 Make __resource_adaptor_imp usable with C++17 memory_resource
By making the memory_resource base class a template parameter the
__resource_adaptor_imp can be used to adapt an allocator into a
std::pmr::memory_resource instead of experimental::pmr::memory_resource.

	* include/experimental/memory_resource: Adjust comments and
	whitespace.
	(__resource_adaptor_imp): Add second template parameter for type of
	memory resource base class.
	(memory_resource): Define default constructor, destructor, copy
	constructor and copy assignment operator as defaulted.

From-SVN: r262944
2018-07-24 14:03:20 +01:00
Jonathan Wakely 0568ade6f8 PR libstdc++/70966 fix lifetime bug for default resource
PR libstdc++/70966
	* include/experimental/memory_resource (__get_default_resource): Use
	placement new to create an object with dynamic storage duration.

From-SVN: r262943
2018-07-24 14:03:11 +01:00
Jonathan Wakely 2d6c8eea1d PR libstdc++/70940 optimize pmr::resource_adaptor for allocators using malloc
pmr::resource_adaptor can avoid allocating an oversized buffer and doing
manual alignment within that buffer when the wrapped allocator is known
to always meet the requested alignment. Specifically, if the allocator
is known to use malloc or new directly, then we can call the allocator
directly for any fundamental alignment.

	PR libstdc++/70940
	* include/experimental/memory_resource
	(__resource_adaptor_common::_AlignMgr::_M_unadjust): Add assertion.
	(__resource_adaptor_common::__guaranteed_alignment): New helper to
	give maximum alignment an allocator guarantees. Specialize for known
	allocators using new and malloc.
	(__resource_adaptor_imp::do_allocate): Use __guaranteed_alignment.
	(__resource_adaptor_imp::do_deallocate): Likewise.
	* testsuite/experimental/memory_resource/new_delete_resource.cc:
	Check that new and delete are called with expected sizes.

From-SVN: r262935
2018-07-23 20:40:28 +01:00
Jonathan Wakely 37cb7887f8 Add experimental::sample and experimental::shuffle from N4531
The additions to <experimental/random> were added in 2015 but the new
algorithms in <experimental/algorithm> were not. This adds them.

	* include/experimental/algorithm (sample, shuffle): Add new overloads
	using per-thread random number engine.
	* testsuite/experimental/algorithm/sample.cc: Simpify and reduce
	dependencies by using __gnu_test::test_container.
	* testsuite/experimental/algorithm/sample-2.cc: New.
	* testsuite/experimental/algorithm/shuffle.cc: New.

From-SVN: r262024
2018-06-25 17:23:49 +01:00
Jonathan Wakely 0b4bc9a1e8 PR libstdc++/86280 fix undefined left shift on 32-bit targets
PR libstdc++/86280
	* include/experimental/memory_resource
	(__resource_adaptor_common::_AlignMgr::_M_token_size): Use type large
	enough for result of left shift.

From-SVN: r261888
2018-06-22 14:05:20 +01:00
Jonathan Wakely e9df6a8f03 PR libstdc++/70940 make pmr::resource_adaptor return aligned memory
PR libstdc++/70940
	* include/experimental/memory_resource
	(__resource_adaptor_imp::do_deallocate): Add missing return.
	* testsuite/experimental/memory_resource/new_delete_resource.cc: New.
	* testsuite/experimental/memory_resource/resource_adaptor.cc: Test
	resource_adaptor with std::allocator, __gnu_cxx::new_allocator and
	__gnu_cxx::malloc_allocator.

From-SVN: r261851
2018-06-21 17:24:00 +01:00
Jonathan Wakely 7956c508dd PR libstdc++/70940 make pmr::resource_adaptor return aligned memory
PR libstdc++/70940
	* include/experimental/memory_resource (__resource_adaptor_common):
	New base class.
	(__resource_adaptor_common::_AlignMgr): Helper for obtaining aligned
	pointer from unaligned, and vice versa.
	(__resource_adaptor_imp::do_allocate): Use _AlignMgr to adjust
	allocated pointer to meet alignment request.
	(__resource_adaptor_imp::do_deallocate): Use _AlignMgr to retrieve
	original pointer for deallocation.
	(__resource_adaptor_imp::do_is_equal): Reformat.
	(__resource_adaptor_imp::_S_aligned_size): Remove.
	(__resource_adaptor_imp::_S_supported): Remove.
	(new_delete_resource): Use __gnu_cxx::new_allocator.
	* testsuite/experimental/memory_resource/resource_adaptor.cc: Test
	extended alignments and use debug_allocator to check for matching
	allocate/deallocate pairs.

From-SVN: r261849
2018-06-21 15:01:11 +01:00
Jonathan Wakely e70359b3de PR libstdc++/70966 make pmr::new_delete_resource() immortal
Construct the program-wide resource objects using placement new. This
means they have dynamic storage duration and won't be destroyed during
termination.

	PR libstdc++/70966
	* include/experimental/memory_resource (__resource_adaptor_imp): Add
	static assertions to enforce requirements on pointer types.
	(__resource_adaptor_imp::get_allocator()): Add noexcept.
	(new_delete_resource, null_memory_resource): Return address of an
	object with dynamic storage duration.
	(__null_memory_resource): Remove.
	* testsuite/experimental/memory_resource/70966.cc: New.

From-SVN: r261818
2018-06-20 20:34:53 +01:00
Jonathan Wakely 9534a5e62d PR libstdc++/78870 support std::filesystem on Windows
PR libstdc++/78870 support std::filesystem on Windows
	* config.h.in: Regenerate.
	* configure: Regenerate.
	* configure.ac: Check for link, readlink and symlink.
	* include/bits/fs_path.h (path::operator/=(const path&)): Move
	definition out of class body.
	(path::is_absolute(), path::_M_append(path)): Likewise.
	(operator<<(basic_ostream, const path&)): Use std::quoted directly.
	(operator>>(basic_istream, path&)): Likewise.
	(u8path): Reorder definitions and fix Windows implementation.
	(path::is_absolute()): Define inline and fix for Windows.
	[!_GLIBCXX_FILESYSTEM_IS_WINDOWS] (path::operator/=(const path&)):
	Define POSIX version inline.
	(path::_M_append(path)): Define inline.
	* include/experimental/bits/fs_path.h (path::is_absolute()): Move
	definition out of class body.
	(operator<<(basic_ostream, const path&)): Fix type of delimiter and
	escape characters.
	(operator>>(basic_istream, path&)): Likewise.
	(path::is_absolute()): Define inline and fix for Windows.
	* src/filesystem/dir-common.h (__gnu_posix): New namespace.
	(__gnu_posix::char_type, __gnu_posix::DIR, __gnu_posix::dirent)
	(__gnu_posix::opendir, __gnu_posix::readdir, __gnu_posix::closedir):
	Define as adaptors for Windows functions/types or as
	using-declarations for POSIX functions/types.
	(_Dir_base, get_file_type): Qualify names to use declarations from
	__gnu_posix namespace.
	(_Dir_base::is_dor_or_dotdot): New helper functions.
	* src/filesystem/dir.cc (_Dir, recursive_directory_iterator): Qualify
	names to use declarations from __gnu_posix namespace.
	* src/filesystem/ops-common.h (__gnu_posix): New nested namespace.
	(__gnu_posix::open, __gnu_posix::close, __gnu_posix::stat_type)
	(__gnu_posix::stat, __gnu_posix::lstat, __gnu_posix::mode_t)
	(__gnu_posix::chmod, __gnu_posix::mkdir, __gnu_posix::getcwd)
	(__gnu_posix::chdir, __gnu_posix::utimbuf, __gnu_posix::utime)
	(__gnu_posix::rename, __gnu_posix::truncate, __gnu_posix::char_type):
	Define as adaptors for Windows functions/types or as
	using-declarations for POSIX functions/types.
	(stat_type, do_copy_file): Qualify names to use declarations from
	__gnu_posix namespace.
	(do_space): Declare new function.
	(make_file_type): Only use S_ISLNK if defined.
	* src/filesystem/ops.cc (char_ptr, filesystem::canonical): Use
	path::value_type not char.
	(filesystem::copy, create_dir, filesystem::create_directory): Qualify
	names to use declarations from __gnu_posix namespace.
	(filesystem::create_hard_link): Check HAVE_LINK autoconf macro and
	add implementation for Windows.
	(filesystem::create_symlink): Check HAVE_SYMLINK autoconf macro.
	(filesystem::current_path(error_code&)): Use __gnu_posix::getcwd.
	[!_PC_PATH_MAX]: Don't use pathconf.
	[PATH_MAX]: Use if defined.
	(filesystem::current_path(const path&, error_code&))
	(filesystem::equivalent, do_stat, filesystem::hard_link_count)
	(filesystem::last_write_time, filesystem::permissions): Use names
	from __gnu_posix.
	(filesystem::read_symlink): Check HAVE_READLINK autoconf macro.
	(filesystem::remove) [_GLIBCXX_FILESYSTEM_IS_WINDOWS]: Add
	implementation for Windows.
	(filesystem::rename, filesystem::resize_file): Use names from
	__gnu_posix.
	(filesystem::space): Use do_space.
	[_GLIBCXX_FILESYSTEM_IS_WINDOWS]: Get absolute path to directory.
	(filesystem::status, filesystem::symlink_status): Use names from
	__gnu_posix.
	(filesystem::temp_directory_path): Add implementation for Windows.
	* src/filesystem/path.cc (dot): Define constant.
	(path::replace_extension): Use dot.
	(path::_M_find_extension): Likewise. Use path::string_type not
	std::string.
	(path::_M_split_cmpts): Use dot.
	(filesystem_error::_M_get_what): Use u8string() not native().
	* src/filesystem/std-dir.cc (_Dir, recursive_directory_iterator):
	Qualify names to use declarations from __gnu_posix namespace.
	* src/filesystem/std-ops.cc (filesystem::absolute(const path&)): Use
	correct error_code.
	(filesystem::absolute(const path&, error_code&)): Add implementation
	for Windows.
	(char_ptr, filesystem::canonical): Use path::value_type not char.
	(do_copy_file): Use names from __gnu_posix.
	[_GLIBCXX_FILESYSTEM_IS_WINDOWS]: Do not use fchmod, fchmodat or
	sendfile.
	(filesystem::copy, create_dir, filesystem::create_directory): Qualify
	names to use declarations from __gnu_posix namespace.
	(filesystem::create_hard_link): Check HAVE_LINK autoconf macro and
	add implementation for Windows.
	(filesystem::create_symlink): Check HAVE_SYMLINK autoconf macro.
	(filesystem::current_path(error_code&)): Use __gnu_posix::getcwd.
	[!_PC_PATH_MAX]: Don't use pathconf.
	[PATH_MAX]: Use if defined.
	(filesystem::current_path(const path&, error_code&))
	(filesystem::equivalent, do_stat, filesystem::hard_link_count)
	(filesystem::last_write_time, filesystem::permissions): Use names
	from __gnu_posix.
	(filesystem::read_symlink): Check HAVE_READLINK autoconf macro.
	(filesystem::remove) [_GLIBCXX_FILESYSTEM_IS_WINDOWS]: Add
	implementation for Windows.
	(filesystem::rename, filesystem::resize_file): Use names from
	__gnu_posix.
	(do_space): Define.
	(filesystem::space): Use do_space.
	(filesystem::status, filesystem::symlink_status): Use names from
	__gnu_posix.
	(filesystem::temp_directory_path): Add implementation for Windows.
	* src/filesystem/std-path.cc
	[_GLIBCXX_FILESYSTEM_IS_WINDOWS] (path::operator/=(const path&)):
	Define for Windows.
	(dot): Define constant.
	(path::replace_extension, is_dot): Use dot.
	(path::lexically_normal): Check _M_type instead of calling
	non-existent function.
	(path::_M_find_extension): Use dot. Use path::string_type not
	std::string.
	(path::_M_split_cmpts): Use dot.
	(filesystem_error::_M_get_what): Use u8string() not native().
	* testsuite/27_io/filesystem/iterators/directory_iterator.cc: Do not
	use symlinks.
	* testsuite/27_io/filesystem/iterators/recursive_directory_iterator.cc:
	Likewise.
	* testsuite/27_io/filesystem/operations/absolute.cc: Use
	__gnu_test::root_path() instead of "/" and add Windows-specific tests.
	* testsuite/27_io/filesystem/operations/canonical.cc: Use
	path::string() to get narrow string, not path::native().
	* testsuite/27_io/filesystem/operations/copy.cc: Construct fstreams
	with std::filesystem::path not std::basic_string.
	* testsuite/27_io/filesystem/operations/copy_file.cc: Likewise.
	* testsuite/27_io/filesystem/operations/exists.cc: Use
	__gnu_test::root_path() instead of "/".
	* testsuite/27_io/filesystem/operations/is_empty.cc: Construct
	fstreams with std::filesystem::path not std::basic_string.
	* testsuite/27_io/filesystem/operations/last_write_time.cc: Use
	path::string() to get narrow string.
	* testsuite/27_io/filesystem/operations/space.cc: Check results for
	errors, expect sensible values otherwise.
	* testsuite/27_io/filesystem/operations/temp_directory_path.cc: Add
	helpers for adjusting the environment on Windows.
	* testsuite/27_io/filesystem/path/append/path.cc: Test
	Windows-specific behaviour.
	* testsuite/27_io/filesystem/path/construct/format.cc: Fix creation
	of path::string_type objects.
	* testsuite/27_io/filesystem/path/construct/locale.cc: Compare native
	string to wide string on Windows.
	* testsuite/27_io/filesystem/path/decompose/root_directory.cc: Allow
	for backslash as root-directory.
	* testsuite/27_io/filesystem/path/decompose/stem.cc: Use
	path::string() to get narrow string.
	* testsuite/27_io/filesystem/path/itr/traversal.cc: Test Windows-style
	paths.
	* testsuite/27_io/filesystem/path/native/string.cc: Use string_type
	not std::string.
	* testsuite/27_io/filesystem/path/query/is_absolute.cc: Adjust for
	different definintion of absolute paths on Windows.
	* testsuite/experimental/filesystem/iterators/directory_iterator.cc:
	Do not use symlinks.
	* testsuite/experimental/filesystem/operations/absolute.cc: Test
	Windows behaviour.
	* testsuite/experimental/filesystem/operations/copy.cc: Construct
	fstreams with NTCTS not std::basic_string.
	* testsuite/experimental/filesystem/operations/copy_file.cc: Likewise.
	* testsuite/experimental/filesystem/operations/exists.cc: Use
	__gnu_test::root_path() instead of "/".
	* testsuite/experimental/filesystem/operations/is_empty.cc: Construct
	fstreams with NTCTS not std::basic_string.
	* testsuite/experimental/filesystem/operations/last_write_time.cc:
	Use path::string() to get narrow string.
	* testsuite/experimental/filesystem/operations/space.cc: Use
	__gnu_test::root_path() instead of "/".
	* testsuite/experimental/filesystem/operations/temp_directory_path.cc:
	Add helpers for adjusting the environment on Windows.
	* testsuite/experimental/filesystem/path/append/path.cc: Use
	path::string() to get narrow strings for comparisons.
	* testsuite/experimental/filesystem/path/concat/path.cc: Likewise.
	* testsuite/experimental/filesystem/path/decompose/root_directory.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/decompose/stem.cc: Likewise.
	* testsuite/experimental/filesystem/path/native/string.cc: Use
	string_type not std::string.
	* testsuite/experimental/filesystem/path/query/is_absolute.cc:
	Adjust for different definintion of absolute paths on Windows.
	* testsuite/util/testsuite_fs.h (__gnu_test::root_path()): New
	function.
	(__gnu_test::scoped_file): Construct fstreams with NTCTS not
	std::basic_string.

From-SVN: r261034
2018-05-31 20:20:24 +01:00
Jonathan Wakely 49d729eaee Refactor path construction from null terminated iterator ranges
Move duplicated code to new _S_string_from_iter function and fix
constraints to accept iterators with const value type.

	* include/bits/fs_path.h (path::__is_encoded_char): Change from class
	template to alias template.
	(path::__value_type_is_char): Use remove_const_t.
	(path:_S_string_from_iter): New helper function.
	(path::_S_convert(InputIter, __null_terminated))
	(path::_S_convert_loc(InputIter, __null_terminated, const locale&)):
	Use _S_string_from_iter.
	(path::string<_CharT, _Allocator>(const _Allocator&)): Allow sharing
	rep for COW strings.
	* include/experimental/bits/fs_path.h (path::__is_encoded_char):
	Change from class template to alias template.
	(path::__value_type_is_char): Use remove_const.
	(path:_S_string_from_iter): New helper function.
	(path::_S_convert(InputIter, __null_terminated))
	(path::_S_convert_loc(InputIter, __null_terminated, const locale&)):
	Use _S_string_from_iter.
	* testsuite/27_io/filesystem/path/append/source.cc: Test appending
	wide strings.
	* testsuite/27_io/filesystem/path/concat/strings.cc: Check for exact
	string equality, not path equivalence.
	* testsuite/27_io/filesystem/path/construct/format.cc: Check
	construction from std::string and std::wstring and input iterators.
	* testsuite/27_io/filesystem/path/construct/locale.cc: Check
	construction from iterators.
	* testsuite/experimental/filesystem/path/concat/strings.cc: Check for
	exact string equality, not path equivalence.
	* testsuite/experimental/filesystem/path/construct/locale.cc: Check
	construction from iterators.

From-SVN: r260628
2018-05-23 23:48:51 +01:00
Jonathan Wakely c3b61fdadd PR libstdc++/83891 fix path::is_absolute() for non-POSIX targets
The correct definition seems to be has_root_directory() for all systems
we care about.

	PR libstdc++/83891
	* include/bits/fs_path.h (path::is_absolute()): Use same definition
	for all operating systems.
	* include/experimental/bits/fs_path.h (path::is_absolute()): Likewise.
	* testsuite/27_io/filesystem/path/query/is_absolute.cc: New.
	* testsuite/27_io/filesystem/path/query/is_relative.cc: Fix comment.
	* testsuite/experimental/filesystem/path/query/is_absolute.cc: New.

From-SVN: r260259
2018-05-15 14:50:49 +01:00
Jonathan Wakely a989f6378b PR libstdc++/85671 allow copy elision in path concatenation
By performing the /= operation on a named local variable instead of a
temporary the copy made for the return value can be elided.

	PR libstdc++/85671
	* include/bits/fs_path.h (operator/): Permit copy elision.
	* include/experimental/bits/fs_path.h (operator/): Likewise.

From-SVN: r260009
2018-05-07 18:26:28 +01:00
Jonathan Wakely f7373fce65 Avoid redundant calls to filesystem::status_known
* include/bits/fs_ops.h (exists(const path&, error_code&))): Only
	check status_known once.
	* include/experimental/bits/fs_ops.h: Likewise.

From-SVN: r256243
2018-01-04 13:46:22 +00:00
Jonathan Wakely 32489ab56a PR libstdc++/83607 specialize Boyer-Moore searchers for std::byte
PR libstdc++/83607
	* include/std/functional (__is_byte_like): New trait.
	(__is_std_equal_to): Remove.
	(__boyer_moore_base_t): Use __is_byte_like instead of
	__is_std_equal_to.
	* include/experimental/functional (__is_std_equal_to): Remove.
	(__boyer_moore_base_t): Use __is_byte_like instead of
	__is_std_equal_to.
	* testsuite/20_util/function_objects/83607.cc: New test.

From-SVN: r256231
2018-01-04 10:21:29 +00:00
Jakub Jelinek 85ec4feb11 Update copyright years.
From-SVN: r256169
2018-01-03 11:03:58 +01:00
Jonathan Wakely ad8fda29e6 Fix narrowing conversions in string_view types
* include/experimental/string_view (basic_string_view::_S_compare):
	Use value-init so narrowing conversions are not ill-formed.
	* include/std/string_view (basic_string_view::_S_compare): Likewise.

From-SVN: r255321
2017-12-01 16:10:31 +00:00
Jonathan Wakely f03858e51d Disable -Wliteral-suffix for standard UDLs
* include/bits/basic_string.h (operator""s): Add pragmas to disable
	-Wliteral-suffix warnings.
	* include/experimental/string_view (operator""sv): Likewise.
	* include/std/chrono (operator""h, operator""min, operator""s)
	(operator""ms, operator""us, operator""ns): Likewise.
	* include/std/complex (operator""if, operator""i, operator""il):
	Likewise.
	* include/std/string_view (operator""sv): Likewise.
	* testsuite/20_util/duration/literals/range.cc: Adjust dg-error.

From-SVN: r255320
2017-12-01 16:10:25 +00: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 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 551124d561 Fix path::iterator post-increment and post-decrement
* 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: r253896
2017-10-19 14:57:06 +01:00
Jonathan Wakely d681026df1 PR libstdc++/79433 no #error for including TS headers with wrong -std
PR libstdc++/79433
	* include/Makefile.am: Remove <bits/c++14_warning.h>.
	* include/Makefile.in: Regenerate.
	* include/bits/c++14_warning.h: Remove.
	* include/experimental/algorithm: Do not include <c++14_warning.h>.
	* include/experimental/any: Likewise.
	* include/experimental/array: Likewise.
	* include/experimental/bits/erase_if.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: Do not include <c++0x_warning.h>.
	* include/experimental/forward_list: Do not include <c++14_warning.h>.
	* include/experimental/functional: Likewise.
	* include/experimental/iterator: Likewise.
	* include/experimental/list: Likewise.
	* include/experimental/map: Likewise.
	* include/experimental/memory: Likewise.
	* include/experimental/numeric: Likewise.
	* include/experimental/optional: Likewise.
	* include/experimental/propagate_const: Likewise.
	* include/experimental/ratio: Likewise.
	* include/experimental/regex: Likewise.
	* include/experimental/set: 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/vector: Likewise.
	* testsuite/experimental/any/misc/any_cast_neg.cc: Adjust dg-error
	line number.
	* testsuite/experimental/array/neg.cc: Likewise.
	* testsuite/experimental/propagate_const/assignment/move_neg.cc:
	Likewise.
	* testsuite/experimental/propagate_const/cons/move_neg.cc: Likewise.
	* testsuite/experimental/propagate_const/requirements2.cc: Likewise.
	* testsuite/experimental/propagate_const/requirements3.cc: Likewise.
	* testsuite/experimental/propagate_const/requirements4.cc: Likewise.
	* testsuite/experimental/propagate_const/requirements5.cc: Likewise.

From-SVN: r252019
2017-09-12 15:03:06 +01:00
Jonathan Wakely 2be7a166a9 PR libstdc++/70483 make std::experimental::string_view fully constexpr
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: r252017
2017-09-12 14:31:20 +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 318c48e304 Prevent __uses_alloc from holding dangling references
* include/bits/uses_allocator.h (__use_alloc(const _Alloc&&)): Add
	deleted overload to prevent dangling references to rvalues.
	* include/experimental/memory_resource
	(polymorphic_allocator::construct): Do not call __use_alloc with
	rvalue arguments.

From-SVN: r250019
2017-07-06 12:54:10 +01:00
Jonathan Wakely 2673bae9d2 Implement std::experimental::source_location (N4519)
* 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: r248110
2017-05-16 14:37:52 +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 71f257f78e PR libstdc++/80493 fix invalid exception specification
PR libstdc++/80493
	* include/experimental/optional (optional::swap): Fix exception
	specification.

From-SVN: r247093
2017-04-24 12:40:02 +01:00
Jonathan Wakely 6cff9199c1 PR libstdc++/80448 remove noexcept from defaulted functions
PR libstdc++/80448
	* include/experimental/bits/fs_dir.h (directory_iterator)
	(recursive_directory_iterator): Remove noexcept from defaulted
	constructors.

From-SVN: r246993
2017-04-19 12:03:43 +01:00
Jonathan Wakely cb701078b1 Ensure <experimental/iterator> includes <iterator>
* include/experimental/iterator: Include <iterator>.
	* testsuite/experimental/iterator/requirements.cc: Check for contents
	of <iterator>.

From-SVN: r245686
2017-02-23 18:25:22 +00:00
Jonathan Wakely 3e5fb20f1f Fix namespace versioning and remove __detail::__identity helpers
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.

From-SVN: r244945
2017-01-26 18:32:55 +00:00
Jonathan Wakely 8cb7179d24 PR libstdc++/79206 check string_view sizes in operator==
PR libstdc++/79206
	* include/experimental/string_view (operator==): Check sizes first.
	* include/std/string_view (operator==): Likewise.

From-SVN: r244865
2017-01-24 12:00:47 +00:00
Jonathan Wakely 61ad58f3aa PR libstdc++/79195 fix make_array type deduction
PR libstdc++/79195
	* include/experimental/array (__make_array_elem): New class template
	and partial specialization.
	(__is_reference_wrapper): Move into __make_array_elem specialization.
	(make_array): Use __make_array_elem to determine element type and move
	static assertion into specialization. Qualify std::forward call.
	(to_array): Add exception specifiation.
	* testsuite/experimental/array/make_array.cc: Test argument types
	without a common type.
	* testsuite/experimental/array/neg.cc: Adjust expected error message.

From-SVN: r244813
2017-01-23 15:56:05 +00:00
Jonathan Wakely 38a9e5a6c0 PR69321 fix any_cast<T>(any*) for non-copyable T
PR libstdc++/69321
	* include/experimental/any (__any_caster): Avoid instantiating
	manager function for types that can't be stored in any.
	* include/std/any (__any_caster): Likewise.
	* testsuite/20_util/any/misc/any_cast.cc: Test non-copyable type.
	* testsuite/experimental/any/misc/any_cast.cc: Likewise.

From-SVN: r244678
2017-01-20 01:22:54 +00:00
Jonathan Wakely 2ae27b7076 PR69301 don't assume atomic<T> can default construct T
PR libstdc++/69301
	* include/std/atomic (atomic<T>::load, atomic<T>::exchange): Use
	aligned buffer instead of default-initialized variable.
	* testsuite/29_atomics/atomic/69301.cc: New test.
	* include/experimental/memory (observer_ptr::release): Use reserved
	name.
	* include/ext/pointer.h (_Pointer_adapter::operator++(int))
	(_Pointer_adapter::operator--(int)): Likewise.

From-SVN: r244588
2017-01-18 18:36:45 +00:00
Jonathan Wakely b08fdbb845 PR68925 don't use thread_local static for stateless object
PR libstdc++/68925
	* include/experimental/random (randint): Use temporary instead of
	thread_local static.

From-SVN: r244584
2017-01-18 17:18:47 +00:00
Jakub Jelinek cbe34bb5ed Update copyright years.
From-SVN: r243994
2017-01-01 13:07:43 +01:00
Jonathan Wakely 435f434288 Replace uses of C++14 remove_cv_t alias in C++11 header
* include/experimental/bits/fs_path.h (path::_S_convert): Replace
	uses of C++14 std::remove_cv_t alias template.

From-SVN: r243355
2016-12-07 15:23:01 +00:00
Ville Voutilainen 1637d42545 Constrain optional's __constexpr_addressof in its return type and use a constexpr addressof for optional, if available.
Constrain optional's __constexpr_addressof in its return type
and use a constexpr addressof for optional, if available.
* include/experimental/optional (__constexpr_addressof):
Constrain in the return type instead of in a template parameter.
(_Has_addressof_mem)
(_Has_addressof_free, _Has_addressof, __constexpr_addressof):
Guard with #ifndef __cpp_lib_addressof_constexpr.
(operator->()): Use std::__addressof if it's constexpr.

From-SVN: r243298
2016-12-06 14:47:54 +02:00
Felix Morgner f6cdfe8264 PR78494 add missing returns to propagate_const
2016-11-23  Felix Morgner  <felix.morgner@gmail.com>
	    Jonathan Wakely  <jwakely@redhat.com>

	PR libstdc++/78494
	* include/experimental/propagate_const (propagate_const::operator=):
	Add missing return statements.
	* testsuite/experimental/propagate_const/assignment/move_neg.cc:
	Adjust dg-error line numbers.
	* testsuite/experimental/propagate_const/requirements2.cc: Likewise.

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

From-SVN: r242760
2016-11-23 14:45:29 +00:00
Jonathan Wakely 881ca4c9de PR78326 fix incorrect access of data member in base class
PR libstdc++/78326
	* include/experimental/memory_resource (memory_resource::_S_max_align):
	Change access to protected.

From-SVN: r242373
2016-11-14 02:00:26 +00:00
Jonathan Wakely b2343559f2 Add array support to std::shared_ptr for C++17
* doc/xml/manual/status_cxx2017.xml: Update status.
	* doc/html/manual/status.html: Regenerate.
	* include/bits/shared_ptr.h (shared_ptr(unique_ptr<_Yp, _Del>)): Add
	extension constructor to maintain C++14 behaviour.
	* include/bits/shared_ptr_base.h (__sp_array_delete): Add new struct.
	(__shared_count(_Ptr, false_type), __shared_count(_Ptr, true_type)):
	New constructors.
	(__sp_compatible_with, __sp_is_constructible): Add specializations
	for array support.
	(__sp_is_constructible_arr, __sp_is_constructible_arrN): New helpers.
	(__shared_ptr_access): New base class for observer member functions.
	(__shared_ptr::element_type): Use remove_extent.
	(__shared_ptr::_UniqCompatible): Add __sp_compatible_with check.
	(__shared_ptr(_Yp*)): Use tag dispatching to call new __shared_count
	constructor.
	(__shared_ptr(unique_ptr<_Yp, _Del>)): Add extension constructor.
	(__shared_ptr::operator*, __shared_ptr::operator->): Remove and
	inherit from __shared_ptr_access base class.
	(__shared_ptr::__has_esft_base): Return false for array types.
	(__weak_ptr::element_type): Use remove_extent.
	* include/experimental/bits/shared_ptr.h (__libfund_v1): Remove.
	(__shared_ptr<__libfund_v1<_Tp>>): Remove specializations.
	(__wak_ptr<__libfund_v1<_Tp>>): Likewise.
	(experimental::__sp_compatible_v): Redefine using
	__sp_compatible_with.
	(experimental::__sp_is_constructible_v): Redefine using
	__sp_is_constructible.
	(get_deleter, operator<<): Change argument from __shared_ptr to
	shared_ptr.
	* testsuite/20_util/shared_ptr/cons/array.cc: New test.
	* testsuite/20_util/shared_ptr/cons/unique_ptr_array.cc: Adjust for
	new behaviour.
	* testsuite/20_util/shared_ptr/observers/array.cc: Test observers for
	arrays.
	* testsuite/20_util/shared_ptr/observers/array_neg.cc: New test.

From-SVN: r242369
2016-11-13 22:57:45 +00:00
Jonathan Wakely f0414b973f Make filesystem::path work with basic_string_view (P0392R0)
* include/experimental/bits/fs_path.h (__is_path_src)
	(_S_range_begin, _S_range_end): Overload to treat string_view as a
	Source object.
	(path::operator+=, path::compare): Overload for basic_string_view.
	* testsuite/experimental/filesystem/path/construct/string_view.cc:
	New test.
	* testsuite/experimental/filesystem/path/construct/
	string_view_cxx17.cc: New test.

From-SVN: r241658
2016-10-28 19:48:43 +01:00
Jonathan Wakely fcfceb1afb Fix filesystem::path for iterators with const value_type
* include/experimental/bits/fs_path.h
	(path::_S_convert<_Iter>(_Iter, _Iter)): Remove cv-qualifiers from
	iterator's value_type.
	(path::_S_convert<_Iter>(_Iter __first, __null_terminated)): Likewise.
	Do not use operation not supported by input iterators.
	(path::__is_path_iter_src): Add partial specialization for const
	encoded character types.
	* testsuite/experimental/filesystem/path/construct/range.cc: Test
	construction from input iterators with const value types.

From-SVN: r241654
2016-10-28 18:47:57 +01:00
Jonathan Wakely ec0b1056a7 Add recursive_directory_iterator::pop(error_code&)
* include/experimental/bits/fs_dir.h (recursive_directory_iterator):
	Overload pop (LWG 2706).
	* src/filesystem/dir.cc (recursive_directory_iterator::pop): Define
	new overload.
	* testsuite/experimental/filesystem/iterators/pop.cc: New test.

From-SVN: r241559
2016-10-26 16:20:04 +01:00
Ville Voutilainen a3f6007cbc Cross-port exception-safety and move fixes of std::any to std::experimental::any.
Cross-port exception-safety and move fixes of std::any to
std::experimental::any.
* include/experimental/any (operator=(const any&)):
Make strongly exception-safe.
(operator=(any&&)): clear() unconditionally in the case where
rhs has a value.
(_Manager_internal<_Tp>::_S_manage): Move in _Op_xfer, don't copy.
* testsuite/experimental/any/assign/2.cc: Adjust.
* testsuite/experimental/any/assign/exception.cc: New.
* testsuite/experimental/any/cons/2.cc: Adjust.
* testsuite/experimental/any/misc/any_cast_neg.cc: Ajust.

From-SVN: r241479
2016-10-24 16:22:11 +03:00
Ville Voutilainen f11cc05023 Cross-port the latest resolution of LWG2756 and some bug-fixes to experimental::optional.
Cross-port the latest resolution of LWG2756 and some
bug-fixes to experimental::optional.
PR libstdc++/77288
PR libstdc++/77727
* include/experimental/optional (_Optional_base):
Remove constructors that take a _Tp.
(__is_optional_impl, __is_optional): Remove.
(__converts_from_optional): New.
(optional(_Up&&)): Fix constraints, call base with in_place.
(optional(const optional<_Up>&)): Fix constraints, use emplace.
(optional(optional<_Up>&&)): Likewise.
(operator=(_Up&&)): Fix constraints.
(operator=(const optional<_Up>&)): Likewise.
(operator=(optional<_Up>&&)): Likewise.
(emplace(_Args&&...)): Constrain.
(emplace(initializer_list<_Up>, _Args&&...)): Likewise.
* testsuite/experimental/optional/77288.cc: New.
* testsuite/experimental/optional/assignment/5.cc: Adjust.
* testsuite/experimental/optional/cons/77727.cc: New.
* testsuite/experimental/optional/cons/value.cc: Adjust.

From-SVN: r241476
2016-10-24 15:46:44 +03:00
Jonathan Wakely d17f7088fb LWG2720 implement filesystem::perms::symlink_nofollow
* include/experimental/bits/fs_fwd.h (perms::resolve_symlinks):
	Replace with symlink_nofollow (LWG 2720).
	* src/filesystem/ops.cc (permissions(const path&, perms, error_code&)):
	Handle symlink_nofollow.
	* testsuite/experimental/filesystem/operations/create_symlink.cc: New
	test.
	* testsuite/experimental/filesystem/operations/permissions.cc: Test
	overload taking error_code.

From-SVN: r241418
2016-10-21 18:01:05 +01:00
Jonathan Wakely 2be9212713 LWG2725 Fix error reporting for filesystem::exists
* include/experimental/bits/fs_ops.h
	(exists(const path&, error_code&)): Clear error if status is known
	(LWG 2725).
	(status(const path&, error_code&)): Handle EOVERFLOW.
	* testsuite/experimental/filesystem/operations/exists.cc: Test
	overload taking an error_code.

From-SVN: r241417
2016-10-21 18:00:59 +01:00
Jonathan Wakely e59e183f69 LWG2707 init filesystem::path from string_type&&
* include/experimental/bits/fs_path.h (path::path(string_type&&))
	(path::operator=(string&&), path::assign(string_type&&)): Define
	construction and assignment from string_type rvalues (LWG 2707).

From-SVN: r241416
2016-10-21 18:00:53 +01:00
Jonathan Wakely f3070dab7a Make std::enable_shared_from_this cope with ambiguity
* include/backward/auto_ptr.h (__shared_ptr(auto_ptr&&)): Call
	_M_enable_shared_from_this_with instead of
	__enable_shared_from_this_helper.
	* include/bits/shared_ptr.h (__enable_shared_from_this_helper):
	Remove overload for std::enable_shared_from_this..
	(__enable_shared_from_this_base): Define friend function to select a
	std::enable_shared_from_this base class.
	* include/bits/shared_ptr_base.h (__enable_shared_from_this_helper):
	Remove all overloads.
	(__shared_ptr): Change all relevant constructors to call
	_M_enable_shared_from_this_with instead of
	__enable_shared_from_this_helper.
	(__shared_ptr::__efst_base_t, __shared_ptr::__has_efst_base): Helpers
	to detect accessible and unambiguous enable_shared_from_this bases.
	(__shared_ptr::_M_enable_shared_from_this_with): New function to
	replace __enable_shared_from_this_helper overloads.
	(__enable_shared_from_this_helper): Remove overload for
	std::__enable_shared_from_this.
	(__enable_shared_from_this_base): Define friend function to select a
	std::__enable_shared_from_this base class.
	* include/experimental/bits/shared_ptr.h (experimental::shared_ptr):
	Change relevant constructors to call _M_enable_shared_from_this_with.
	(experimental::shared_ptr::__efst_base_t)
	(experimental::shared_ptr::__has_efst_base): Helpers to detect
	accessible and unambiguous enable_shared_from_this bases.
	(experimental::shared_ptr::_M_enable_shared_from_this_with): Define.
	(experimental::__enable_shared_from_this_helper): Remove overload for
	std::experimental::enable_shared_from_this.
	(experimental::__expt_enable_shared_from_this_base): Define friend
	function to select a std::experimental::enable_shared_from_this base.
	* testsuite/experimental/memory/shared_ptr/cons/
	enable_shared_from_this.cc: New test.
	* testsuite/experimental/memory/shared_ptr/cons/unique_ptr_ctor.cc:
	Adjust expected behaviour for shared_ptr<A[]>.

From-SVN: r241353
2016-10-19 21:13:14 +01:00
Jonathan Wakely 84870b6bb2 Fix std::experimental::shared_ptr SFINAE constraints
* include/experimental/bits/shared_ptr.h
	(__shared_ptr<__libfund_v1<_Tp, false>, _Lp>::_Compatible): Just use
	is_convertible for non-array specialization.
	(__shared_ptr<__libfund_v1<_Tp, false>, _Lp>::_UniqCompatible): New
	constraint for conversions from unique_ptr.
	(__shared_ptr<__libfund_v1<_Tp, false>, _Lp>::__shared_ptr): Constrain.
	(__shared_ptr<__libfund_v1<_Tp, false>, _Lp>::reset): Likewise.
	(__sp_compatible_v): New variable template for trait.
	(__sp_is_constructible): New trait to check shared_ptr constraints.
	(__sp_is_constructible_v): New variable template for trait.
	(__shared_ptr<__libfund_v1<_Tp, true>, _Lp>::_SafeConv): New
	constraint for construction/reset, using __sp_is_constructible_v.
	(__shared_ptr<__libfund_v1<_Tp, true>, _Lp>::_UniqCompatible): New
	constraint for conversions from unique_ptr.
	(__shared_ptr<__libfund_v1<_Tp, true>, _Lp>::__shared_ptr): Constrain.
	(__shared_ptr<__libfund_v1<_Tp, true>, _Lp>::reset): Likewise.
	(shared_ptr::_SafeConv): Constraint for checking constructors.
	(shared_ptr(Tp1*), shared_ptr(_Tp1, _Deleter))
	(shared_ptr(_Tp1, _Deleter, _Alloc)): Constrain with _SafeConv.
	(shared_ptr(const weak_ptr<_Tp1>&)): Constrain with _Compatible.
	(shared_ptr(auto_ptr<_Tp1>&&)): Fix, remove TODO.
	* testsuite/experimental/memory/shared_ptr/cons/pointer_ctor.cc:
	Remove tests using invalid conversions.
	* testsuite/experimental/memory/shared_ptr/cons/pointer_ctor_neg.cc:
	New test.
	* testsuite/experimental/memory/shared_ptr/cons/torture.cc: New test.
	* testsuite/experimental/memory/shared_ptr/modifiers/reset.cc: Remove
	tests using invalid conversions.
	* testsuite/experimental/memory/shared_ptr/modifiers/reset_neg.cc: New
	test.
	* testsuite/experimental/memory/shared_ptr/observers/use_count.cc:
	Remove tests using invalid conversions.

From-SVN: r241331
2016-10-19 10:35:03 +01:00
Jonathan Wakely 6dddab0845 Fix indentation of experimental::shared_ptr code
* include/experimental/bits/shared_ptr.h: Fix indentation.

From-SVN: r241311
2016-10-18 19:41:43 +01:00
Jonathan Wakely 8a9ff71f5b Fix typos in experimental::shared_ptr
* include/experimental/bits/shared_ptr.h (shared_ptr(shared_ptr&&)):
	Remove const from parameter.
	(operator<(const shared_ptr<T>&, nullptr_t)): Use correct
	specialization of std::less.
	* testsuite/experimental/memory/shared_ptr/comparison/comparison.cc:
	Test comparison with nullptr and actually call test functions.

From-SVN: r241310
2016-10-18 19:30:38 +01:00
Jonathan Wakely 12d3f34b33 PR77994 Convert std::sample size argument to suitable type
PR libstdc++/77994
	* include/bits/stl_algo.h (sample): Convert size argument to iterator
	difference type.
	* include/experimental/algorithm (experimental::sample): Likewise.
	* testsuite/25_algorithms/sample/2.cc: New test.

From-SVN: r241245
2016-10-17 15:39:23 +01:00
Jonathan Wakely d67dd0be94 Avoid #include <functional> in other headers
* include/bits/shared_ptr_base.h: Include <functional>.
	[!__cpp_rtti]: Do not include <typeinfo>.
	* include/experimental/array: Do not include <functional>.
	* include/experimental/memory: Include <bits/functional_hash.h>
	instead of <functional>.
	* include/experimental/propagate_const: Include <bits/stl_function.h>,
	<bits/functional_hash.h>, and <bits/move.h> instead of <functional>.
	* include/experimental/tuple: Do not include <functional>.
	* include/std/future: Include <functional>.
	* include/std/memory: Do not include <functional>.
	* include/std/mutex: [_GLIBCXX_HAVE_TLS]: Likewise.
	* testsuite/20_util/shared_ptr/thread/default_weaktoshared.cc: Add
	missing includes.
	* testsuite/20_util/shared_ptr/thread/mutex_weaktoshared.cc: Likewise.
	* testsuite/20_util/specialized_algorithms/memory_management_tools/
	1.cc: Likewise.
	* testsuite/30_threads/call_once/60497.cc: Likewise.
	* testsuite/30_threads/lock/2.cc: Likewise.
	* testsuite/30_threads/thread/native_handle/cancel.cc: Likewise.
	* testsuite/experimental/algorithm/sample.cc: Likewise.
	* testsuite/experimental/array/make_array.cc: Likewise.
	* testsuite/experimental/array/neg.cc: Likewise. Adjust dg-error line.
	* testsuite/experimental/propagate_const/assignment/move_neg.cc:
	Adjust dg-error lines.
	* testsuite/experimental/propagate_const/cons/move_neg.cc: Likewise.
	* testsuite/experimental/propagate_const/requirements2.cc: Likewise.
	* testsuite/experimental/propagate_const/requirements3.cc: Likewise.
	* testsuite/experimental/propagate_const/requirements4.cc: Likewise.
	* testsuite/experimental/propagate_const/requirements5.cc: Likewise.

From-SVN: r241131
2016-10-13 17:59:19 +01:00
Jonathan Wakely 10482a6598 Qualify use of std::declval to avoid ADL
* include/experimental/propagate_const (element_type): Qualify
	declval.

From-SVN: r241129
2016-10-13 17:41:10 +01:00
Jonathan Wakely 5117a23e9f Use normal mode containers in searchers
* include/experiumental/functional (boyer_moore_searcher)
	(__boyer_moore_map_base, __boyer_moore_array_base): Qualify containers
	with _GLIBCXX_STD_C.
	* include/std/functional: Likewise.

From-SVN: r241126
2016-10-13 16:50:35 +01:00
Jonathan Wakely e7722f1106 Define std::sample for C++17
* doc/xml/manual/status_cxx2017.xml: Add std::sample status.
	* doc/html/*: Regenerate.
	* include/experimental/algorithm (__sample): Move to bits/stl_algo.h
	and into namespace std.
	* include/bits/stl_algo.h (__sample): Define here. Fix invalid use
	of input iterator. Defend against overloaded comma operator.
	(sample): Define for C++17.
	* testsuite/25_algorithms/sample/1.cc: New test.

From-SVN: r241062
2016-10-12 16:26:48 +01:00
Jonathan Wakely 7571121f10 Remove redundant const qualifliers from string_view
* include/experimental/string_view (basic_string_view::_S_compare):
	Remove redundant const from return type.
	* include/std/string_view (basic_string_view:_S_compare): Likewise.

From-SVN: r240981
2016-10-11 11:33:24 +01:00
Jonathan Wakely f2e79496bf LWG 2733, LWG 2759 reject bool in gcd and lcm
* include/experimental/numeric (gcd, lcm): Make bool arguments
	ill-formed.
	* include/std/numeric (gcd, lcm): Likewise.
	* testsuite/26_numerics/gcd/gcd_neg.cc: New test.
	* testsuite/26_numerics/lcm/lcm_neg.cc: New test.

From-SVN: r240919
2016-10-10 13:17:34 +01:00
Jonathan Wakely 78ec9c15be PR 70564 disambiguate constructors for not_fn call wrapper
PR libstdc++/70564
	* include/experimental/functional (_Not_fn): Remove.
	(not_fn): Use std::_Not_fn.
	* include/std/functional (_Not_fn): Add second parameter to
	disambiguate copying from initialization by not_fn. Define for C++14.
	(not_fn): Add second argument to initialization.
	* testsuite/20_util/not_fn/1.cc: Copy call wrapper using
	direct-initialization.

From-SVN: r240778
2016-10-05 13:01:36 +01:00
Jonathan Wakely 606dda21c8 Define std::gcd and std::lcm for C++17
* doc/xml/manual/status_cxx2017.xml: Update gcd/lcm status.
	* doc/html/*: Regenerate.
	* include/experimental/numeric (__abs): Move to <numeric>.
	(gcd, lcm): Use __detail::gcd and __detail::lcm.
	* include/std/numeric (__detail::__abs_integral)
	(__detail::__gcd, __detail::__lcm): Define.
	(gcd, lcm): Define for C++17.
	* testsuite/26_numerics/gcd/1.cc: New test.
	* testsuite/26_numerics/lcm/1.cc: New test.
	* testsuite/experimental/numeric/gcd.cc: Swap contents with ...
	* testsuite/experimental/numeric/lcd.cc: ... this.

From-SVN: r240723
2016-10-03 18:01:10 +01:00
Jonathan Wakely e347987da8 Fix libstdc++ versioned namespace build
PR libstdc++/68323
	PR libstdc++/77794
	* config/abi/pre/gnu-versioned-namespace.ver: Add exports for
	__cxa_thread_atexit and __gnu_cxx::__freeres.
	* include/Makefile.am: Add <experimental/bits/lfts_config.h>
	* include/Makefile.in: Regenerate.
	* include.bits/basic_string.h: Fix nesting of versioned namespaces.
	* include/bits/c++config: Declare versioned namespaces for literals.
	* include/bits/regex.h (basic_regex, match_results): Add workarounds
	for PR c++/59256.
	* include/bits/uniform_int_dist.h: Fix nesting of versioned namespace.
	* include/std/chrono: Likewise.
	* include/std/complex: Likewise.
	* include/std/string_view: Likewise.
	* include/std/variant: Likewise. Add workaround for PR c++/59256.
	* include/experimental/bits/fs_fwd.h: Declare versioned namespace.
	* include/experimental/bits/lfts_config.h: Declare versioned
	namespaces.
	* include/experimental/algorithm: Include
	<experimental/bits/lfts_config.h>.
	* include/experimental/any: Likewise.
	* include/experimental/bits/erase_if.h: Likewise.
	* include/experimental/chrono: Likewise.
	* include/experimental/functional: Likewise.
	* include/experimental/memory_resource: Likewise.
	* include/experimental/optional: Likewise.
	* include/experimental/propagate_const: Likewise.
	* include/experimental/random: Likewise.
	* include/experimental/ratio: Likewise.
	* include/experimental/system_error: Likewise.
	* include/experimental/tuple: Likewise.
	* include/experimental/type_traits: Likewise.
	* include/experimental/utility: Likewise.
	* include/experimental/string_view: Likewise. Fix nesting of
	versioned namespaces.
	* include/experimental/bits/string_view.tcc: Reopen inline namespace
	for non-inline function definitions.
	* testsuite/17_intro/using_namespace_std_exp_neg.cc: New test.
	* testsuite/20_util/duration/literals/range.cc: Adjust dg-error line.
	* testsuite/experimental/any/misc/any_cast_neg.cc: Likewise.
	* testsuite/experimental/propagate_const/assignment/move_neg.cc:
	Likewise.
	* testsuite/experimental/propagate_const/cons/move_neg.cc: Likewise.
	* testsuite/experimental/propagate_const/requirements2.cc: Likewise.
	* testsuite/experimental/propagate_const/requirements3.cc: Likewise.
	* testsuite/experimental/propagate_const/requirements4.cc: Likewise.
	* testsuite/experimental/propagate_const/requirements5.cc: Likewise.
	* testsuite/ext/profile/mutex_extensions_neg.cc: Likewise.

From-SVN: r240714
2016-10-03 15:35:28 +01:00
Jonathan Wakely 9e28a77462 Remove use of std::abs in experimental::{gcd,lcm}
PR libstdc++/77801
	* include/experimental/numeric: Include <numeric>.
	(__abs): Define.
	(gcd, lcm): Use __abs instead of std::abs.
	* testsuite/experimental/numeric/77801.cc: New test.
	* testsuite/experimental/numeric/gcd.cc: Test unsigned inputs.
	* testsuite/experimental/numeric/lcm.cc: Likewise.

From-SVN: r240656
2016-09-30 14:43:37 +01:00
Jonathan Wakely fd5effb17e Check for overflow in filesystem::last_write_time
* include/experimental/bits/fs_fwd.h (file_time_type): Simplify
	definition.
	* src/filesystem/ops.cc (file_time): Take error_code parameter and
	check for overflow.
	(do_copy_file, last_write_time): Pass error_code in file_time calls.
	* testsuite/experimental/filesystem/operations/last_write_time.cc:
	New.
	* testsuite/util/testsuite_fs.h (scoped_file): Define RAII helper.

From-SVN: r240587
2016-09-28 19:02:25 +01:00
Jonathan Wakely e6ee5bfd68 Define std::not_fn for C++17
* doc/xml/manual/status_cxx2017.xml: Update status of not_fn.
	* doc/html/*: Regenerate.
	* include/experimental/functional (_Not_fn, not_fn): Match C++17
	semantics.
	* include/std/functional (_Not_fn, not_fn): Define for C++17.
	* testsuite/20_util/not_fn/1.cc: New.
	* testsuite/experimental/functional/not_fn.cc: Test abstract class.
	Remove test for volatile-qualified wrapper.

From-SVN: r239623
2016-08-19 16:42:34 +01:00
Jonathan Wakely 285ee2fb11 Fix ambiguities in C++17 mode
* include/experimental/tuple (apply): Qualify call to __apply_impl.
	* include/std/tuple (apply): Likewise.
	* testsuite/experimental/system_error/value.cc: Fix ambiguities in
	C++17 mode.
	* testsuite/experimental/tuple/tuple_size.cc: Likewise.
	* testsuite/experimental/type_traits/value.cc: Likewise.

From-SVN: r239621
2016-08-19 16:42:11 +01:00
Jonathan Wakely 3e9f67e6a2 Add std::apply for C++17
* doc/xml/manual/status_cxx2017.xml: Add missing LFTSv2 features.
	* doc/html/manual/status.html: Regenerate.
	* include/Makefile.am: Add new header.
	* include/Makefile.in: Regenerate.
	* include/bits/invoke.h: New header.
	(__invoke): Make constexpr. Add && to types in exception specification.
	* include/experimental/tuple (apply, __apply_impl): Fix non-reserved
	names. Include <bits/invoke.h> and use std::__invoke.
	* include/std/functional (__invfwd, __invoke_impl, __invoke): Move to
	new header.
	(invoke): Add && to types in exception specification.
	* include/std/tuple (apply, __apply_impl): Define for C++17.
	* testsuite/20_util/tuple/apply/1.cc: New test.
	* testsuite/20_util/tuple/element_access/get_neg.cc: Adjust dg-error
	lineno.

From-SVN: r239183
2016-08-06 01:06:02 +01:00
Jonathan Wakely 8b649cd3ba Fix naming, qualification and broken test for propagate_const
* include/experimental/propagate_const (propagate_const::__t): Rename
	to _M_t and remove comment. Qualify std::move and std::forward.
	* testsuite/experimental/propagate_const/cons/default.cc: Fix test.

From-SVN: r238611
2016-07-21 20:39:03 +01:00
Jonathan Wakely ea5ec6b7e0 Include header for std::__parallel::search
* include/experimental/functional: Include <parallel/algorithm> in
	Parallel Mode.

From-SVN: r238342
2016-07-14 16:43:17 +01:00
Ville Voutilainen 86c0ec1de1 Implement P0307R2, Making Optional Greater Equal Again.
* include/experimental/optional (_Has_addressof): Fix the comment.
	* include/std/optional (_Has_addressof): Likewise.
	(operator=(_Up&&)): Constrain.
	(operator=(const optional<_Up>&)): Likewise.
	(operator=(optional<_Up>&&)): Likewise.
	(__optional_relop_t): New.
	(operator==(const optional<_Tp>&, const optional<_Tp>&)): Constrain.
	(operator!=(const optional<_Tp>&, const optional<_Tp>&)):
	Constrain and make transparent.
	(operator<(const optional<_Tp>&, const optional<_Tp>&)): Constrain.
	(operator>(const optional<_Tp>&, const optional<_Tp>&)):
	Constrain and make transparent.
	(operator<=(const optional<_Tp>&, const optional<_Tp>&)): Likewise.
	(operator>=(const optional<_Tp>&, const optional<_Tp>&)): Likewise.
	(operator==(const optional<_Tp>&, const _Tp&): Constrain.
	(operator==(const _Tp&, const optional<_Tp>&)): Likewise.
	(operator!=(const optional<_Tp>&, _Tp const&)):
	Constrain and make transparent.
	(operator!=(const _Tp&, const optional<_Tp>&)): Likewise.
	(operator<(const optional<_Tp>&, const _Tp&)): Constrain.
	(operator<(const _Tp&, const optional<_Tp>&)): Likewise.
	(operator>(const optional<_Tp>&, const _Tp&)):
	Constrain and make transparent.
	(operator>(const _Tp&, const optional<_Tp>&)): Likewise.
	(operator<=(const optional<_Tp>&, const _Tp&)): Likewise.
	(operator<=(const _Tp&, const optional<_Tp>&)): Likewise.
	(operator>=(const optional<_Tp>&, const _Tp&)): Likewise.
	(operator>=(const _Tp&, const optional<_Tp>&)): Likewise.
	* testsuite/20_util/optional/constexpr/relops/2.cc: Adjust.
	* testsuite/20_util/optional/constexpr/relops/4.cc: Likewise.
	* testsuite/20_util/optional/relops/1.cc: Likewise.
	* testsuite/20_util/optional/relops/2.cc: Likewise.
	* testsuite/20_util/optional/relops/3.cc: Likewise.
	* testsuite/20_util/optional/relops/4.cc: Likewise.
	* testsuite/20_util/optional/requirements.cc: Add tests to verify
	that optional's relops are transparent and don't synthesize
	operators. Also test that assignment sfinaes.

From-SVN: r238292
2016-07-13 14:25:51 +03:00
Ville Voutilainen 6ffe854859 Implement LWG 2451, optional<T> should 'forward' T's implicit conversions.
Implement LWG 2451, optional<T> should 'forward' T's
	implicit conversions.
	* include/experimental/optional (__is_optional_impl, __is_optional):
	New.
	(optional()): Make constexpr and default.
	(optional(_Up&&), optional(const optional<_Up>&),
	optional(optional<_Up>&& __t): New.
	(operator=(_Up&&)): Constrain.
	(operator=(const optional<_Up>&), operator=(optional<_Up>&&)): New.
	* testsuite/experimental/optional/cons/value.cc:
	Add tests for the functionality added by LWG 2451.
	* testsuite/experimental/optional/cons/value_neg.cc: New.

From-SVN: r238049
2016-07-06 16:26:10 +03:00
Ville Voutilainen 7d4f48b5b8 Implement LWG 2509,
any_cast doesn't work with rvalue reference targets and cannot
	move with a value target.
	* include/experimental/any (any(_ValueType&&)): Constrain and
	add an overload that doesn't forward.
	(any_cast(any&&)): Constrain and add an overload that moves.
	* testsuite/experimental/any/misc/any_cast.cc: Add tests for
	the functionality added by LWG 2509.

From-SVN: r238022
2016-07-05 21:33:18 +03:00
Jonathan Wakely 7f99d40a99 Test begin and end functions for directory iterators
* include/experimental/bits/fs_dir.h (begin, end): Add noexcept.
	* testsuite/experimental/filesystem/iterators/directory_iterator.cc:
	Test begin and end functions.
	* testsuite/experimental/filesystem/iterators/
	recursive_directory_iterator.cc: Likewise.

From-SVN: r236085
2016-05-10 16:39:20 +01:00
Jonathan Wakely 77a87b2a0e Optimize __directory_iterator_proxy for the common case
* include/experimental/bits/fs_dir.h (__directory_iterator_proxy):
	Overload operator* to move from rvalues.

From-SVN: r236078
2016-05-10 14:09:22 +01:00
Jonathan Wakely d7187f9ea1 libstdc++/71005 fix post-increment for filesystem iterators
PR libstdc++/71005
	* include/experimental/bits/fs_dir.h (__directory_iterator_proxy):
	New type.
	(directory_iterator::operator++(int)): Return proxy.
	(recursive_directory_iterator::operator++(int)): Likewise.
	* testsuite/experimental/filesystem/iterators/directory_iterator.cc:
	Test post-increment.
	* testsuite/experimental/filesystem/iterators/
	recursive_directory_iterator.cc: Likewise.

From-SVN: r236072
2016-05-10 12:25:06 +01:00
Jonathan Wakely e4cce0cea0 libstdc++/71004 fix recursive_directory_iterator default constructor
PR libstdc++/71004
	* include/experimental/bits/fs_dir.h (recursive_directory_iterator):
	Initialize scalar member variables in default constructor.
	* testsuite/experimental/filesystem/iterators/
	recursive_directory_iterator.cc: Teste default construction.

From-SVN: r236023
2016-05-09 11:09:37 +01:00
Jonathan Wakely d9cb3e7598 libstdc++/70940 Start fixing polymorphic memory resources
PR libstdc++/70940
	* include/experimental/memory_resource
	(__resource_adaptor_imp::do_allocate): Do not default-construct
	rebound allocator.
	(__resource_adaptor_imp::do_deallocate): Likewise. Use
	allocator_traits to get pointer type.
	(__null_memory_resource::do_allocate): Remove unused parameters.
	(__null_memory_resource::do_deallocate): Likewise.
	(__null_memory_resource::do_is_equal): Likewise. Add return statement.
	* testsuite/experimental/type_erased_allocator/1.cc: Combine with ...
	* testsuite/experimental/type_erased_allocator/1_neg.cc: This, and
	move to ...
	* testsuite/experimental/memory_resource/1.cc: Here.
	* testsuite/experimental/memory_resource/null_memory_resource.cc: New.
	* testsuite/experimental/memory_resource/resource_adaptor.cc: New.

From-SVN: r235868
2016-05-04 13:08:45 +01:00
Jonathan Wakely 9c476ad426 Add noexcept to Filesystem TS operators
* include/experimental/bits/fs_fwd.h (operator&, operator|, operator^,
	operator~ operator&=, operator|=, operator^=): Add noexcept to
	overloaded operators for copy_options, perms and directory_options.
	* src/filesystem/ops.cc (make_file_type, make_file_status,
	is_not_found_errno, file_time): Add noexcept.

From-SVN: r235214
2016-04-19 19:02:32 +01:00
Jonathan Wakely 86715b0917 libstdc++/69939 Qualify get and forward
PR libstdc++/69939
	* include/experimental/tuple (__apply_impl): Qualify get and forward.

From-SVN: r233666
2016-02-24 13:59:29 +00:00
Jakub Jelinek 818ab71a41 Update copyright years.
From-SVN: r232055
2016-01-04 15:30:50 +01:00
Jonathan Wakely aca12aff8b Fix dejagnu directives in shared_ptr test
PR libstdc++/68825
	* include/experimental/bits/shared_ptr.h (__shared_ptr, __weak_ptr,
	experimental::shared_ptr, experimental::weak_ptr): Constrain
	assignment operators.
	* testsuite/experimental/memory/shared_ptr/cons/copy_ctor_neg.cc:
	Change to a compile-only test and change dg-excess-errors to dg-error.

From-SVN: r231516
2015-12-10 14:32:16 +00:00
Jonathan Wakely 6b4f890601 Improve generated libstdc++ API docs
* doc/doxygen/user.cfg.in: Use EXTENSION_MAPPING tag. Add new headers
	to INPUT. Remove obsolete XML_SCHEMA and XML_DTD tags. Update
	PREDEFINED macros. Set BRIEF_MEMBER_DESC for man-pages.
	* include/backward/strstream: Correct @file comment.
	* include/bits/forward_list.h: Improve Doxygen comments.
	* include/bits/locale_facets_nonio.h: Likewise.
	* include/bits/mutex.h: Likewise.
	* include/bits/shared_ptr.h: Likewise.
	* include/bits/stl_deque.h: Likewise.
	* include/debug/vector (_Safe_vector): Add @brief section to comment.
	* include/experimental/bits/fs_dir.h: Correct @file comment.
	* include/experimental/bits/fs_fwd.h: Likewise.
	* include/experimental/bits/fs_ops.h: Likewise.
	* include/experimental/bits/fs_path.h: Likewise.
	* include/experimental/bits/string_view.tcc: Likewise.
	* include/experimental/optional: Document experimental status.
	* include/experimental/string_view: Correct @file comment.
	* include/ext/pb_ds/detail/bin_search_tree_/traits.hpp: Reduce
	whitespace to avoid Doxygen bug.
	* include/std/bitset: Remove redundant @class Doxygen command. Add
	parentheses to avoid Doxygen bug.
	* include/std/mutex: Improve Doxygen comments.
	* include/tr2/dynamic_bitset: Add missing @param documentation.
	* scripts/run_doxygen: Rename man pages for std::experimental types.

From-SVN: r231512
2015-12-10 14:02:52 +00:00
Jonathan Wakely 22f5095f31 Define path::_Cmpt after specializing path::__is_encoded_char
* include/experimental/bits/fs_path.h (path::_Cmpt): Move definition
	after path::__is_encoded_char explicit specializations.

From-SVN: r231107
2015-12-01 11:33:17 +00:00
Jonathan Wakely 5ae465c530 Define std::experimental::randint etc.
* include/Makefile.am: Add new header.
	* include/Makefile.in: Regenerate.
	* include/experimental/random: New.
	* testsuite/experimental/random/randint.cc: New.

From-SVN: r230332
2015-11-13 16:49:40 +00:00
Jonathan Wakely 011b25e4f5 * include/experimental/bits/shared_ptr.h: Tweak comments.
From-SVN: r230306
2015-11-13 11:30:30 +00:00
Fan You 930d560203 Implement std::experimental::shared_ptr with array support
2015-11-13  Fan You  <youfan.noey@gmail.com>
	    Jonathan Wakely  <jwakely@redhat.com>

	* include/Makefile.am: Add new header.
	* include/Makefile.in: Regenerate.
	* include/experimental/bits/shared_ptr.h: New.
	* include/experimental/memory: Include new header.
	* testsuite/experimental/memory/shared_ptr/assign/assign.cc: New.
	* testsuite/experimental/memory/shared_ptr/cast/cast.cc: New.
	* testsuite/experimental/memory/shared_ptr/comparison/comparison.cc:
	New.
	* testsuite/experimental/memory/shared_ptr/cons/alias_ctor.cc: New.
	* testsuite/experimental/memory/shared_ptr/cons/alloc_ctor.cc: New.
	* testsuite/experimental/memory/shared_ptr/cons/copy_ctor.cc: New.
	* testsuite/experimental/memory/shared_ptr/cons/copy_ctor_neg.cc: New.
	* testsuite/experimental/memory/shared_ptr/cons/default_ctor.cc: New.
	* testsuite/experimental/memory/shared_ptr/cons/move_ctor.cc: New.
	* testsuite/experimental/memory/shared_ptr/cons/pointer_ctor.cc: New.
	* testsuite/experimental/memory/shared_ptr/cons/unique_ptr_ctor.cc:
	New.
	* testsuite/experimental/memory/shared_ptr/cons/weak_ptr_ctor.cc: New.
	* testsuite/experimental/memory/shared_ptr/dest/dest.cc: New.
	* testsuite/experimental/memory/shared_ptr/modifiers/reset.cc: New.
	* testsuite/experimental/memory/shared_ptr/modifiers/swap.cc: New.
	* testsuite/experimental/memory/shared_ptr/observers/bool_conv.cc:
	New.
	* testsuite/experimental/memory/shared_ptr/observers/operators.cc:
	New.
	* testsuite/experimental/memory/shared_ptr/observers/owner_before.cc:
	New.
	* testsuite/experimental/memory/shared_ptr/observers/use_count.cc: New.

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

From-SVN: r230300
2015-11-13 11:05:28 +00:00
Jonathan Wakely 8014404589 Define alias templates using polymorphic memory resources
* include/Makefile.am: Add new header.
	* include/Makefile.in: Regenerate.
	* include/experimental/memory_resource: Add feature-test macro.
	* include/experimental/regex: New.
	* include/experimental/deque: Add alias template using PMR.
	* include/experimental/forward_list: Likewise.
	* include/experimental/list: Likewise.
	* include/experimental/map: Likewise.
	* include/experimental/set: Likewise.
	* include/experimental/string: Likewise.
	* include/experimental/unordered_map: Likewise.
	* include/experimental/unordered_set: Likewise.
	* include/experimental/vector: Likewise.

From-SVN: r230295
2015-11-13 10:01:05 +00:00
Fan You bfeffbd1ae Implement C++ LFTSv1 polymorphic memory resources
2015-11-13  Fan You  <youfan.noey@gmail.com>

	* include/Makefile.am: Add new headers.
	* include/Makefile.in: Regenerate.
	* include/bits/uses_allocator.h (__erased_type): Define.
	(__uses_allocator_helper): Check for __erased_type.
	* include/experimental/memory_resource: New.
	* include/experimental/utlity: New.
	* testsuite/experimental/type_erased_allocator/1.cc: New.
	* testsuite/experimental/type_erased_allocator/1_neg.cc: New.
	* testsuite/experimental/type_erased_allocator/2.cc: New.
	* testsuite/experimental/type_erased_allocator/uses_allocator.cc: New.

From-SVN: r230294
2015-11-13 10:00:59 +00:00
Ville Voutilainen c3a6648b1c Implement D0013R2, logical type traits.
2015-11-12  Ville Voutilainen  <ville.voutilainen@gmail.com>

	Implement D0013R2, logical type traits.

	/libstdc++-v3
	* include/experimental/type_traits (conjunction_v, disjunction_v,
	negation_v): New.
	* include/std/type_traits (conjunction, disjunction, negation):
	Likewise.
	* testsuite/20_util/declval/requirements/1_neg.cc: Adjust.
	* testsuite/20_util/make_signed/requirements/typedefs_neg.cc: Likewise.
	* testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc:
	Likewise.
	* testsuite/experimental/type_traits/value.cc: Likewise.
	* testsuite/20_util/logical_traits/requirements/explicit_instantiation.cc: New.
	* testsuite/20_util/logical_traits/requirements/typedefs.cc: Likewise.
	* testsuite/20_util/logical_traits/value.cc: Likewise.

	/testsuite
	* g++.dg/cpp0x/Wattributes1.C: Adjust.

From-SVN: r230258
2015-11-12 15:56:31 +02:00
Jonathan Wakely 53dc6fb862 * include/experimental/bits/string_view.tcc: Fix doxygen @file.
From-SVN: r230221
2015-11-12 10:08:49 +00:00
Jonathan Wakely ea4554eaea Add include/experimental/bits dir
From-SVN: r228645
2015-10-09 12:11:54 +01:00
Jonathan Wakely 7fcdbdd21d Allow Filesystem TS to compile without wchar_t
* include/bits/locale_conv.h [!_GLIBCXX_USE_WCHAR_T]
	(__do_str_codecvt, __str_codecvt_in, __str_codecvt_out): Enable.
	* include/experimental/fs_path.h [!_GLIBCXX_USE_WCHAR_T]
	(path::wstring, path::generic_wstring): Disable.
	* src/filesystem/path.cc (path::_S_convert_loc)
	[!_GLIBCXX_USE_WCHAR_T]: Skip conversion.
	* testsuite/experimental/filesystem/path/assign/assign.cc: Check for
	wchar_t support.
	* testsuite/experimental/filesystem/path/concat/strings.cc: Likewise.
	* testsuite/experimental/filesystem/path/construct/range.cc: Likewise.

From-SVN: r228417
2015-10-02 20:38:38 +01:00
Jonathan Wakely 429ee11aa3 Fix semantics of Filesystem TS directory iterators
[class.directory_iterator] p4 and [directory_iterator.members] p4
require that only the default constructor and ignored permission denied
errors can create the end iterator.

	* acinclude.m4 (GLIBCXX_CHECK_FILESYSTEM_DEPS): Remove _GLIBCXX_
	prefix from HAVE_STRUCT_DIRENT_D_TYPE.
	* config.h.in: Regenerate.
	* configure: Regenerate.
	* include/experimental/fs_dir.h (operator==, operator==):
	Use owner_before instead of pointer equality.
	(directory_iterator(std::shared_ptr<_Dir>, error_code*)): Remove.
	* src/filesystem/dir.cc (ErrorCode): Remove.
	(_Dir::advance): Change ErrorCode parameter to error_code*, add
	directory_options parameter and check it on error.
	(opendir): Rename to open_dir to avoid clashing with macro. Change
	ErrorCode parameter to error_code*.
	(make_shared_dir): Remove.
	(native_readdir) [_GLIBCXX_FILESYSTEM_IS_WINDOWS]: Don't set errno.
	(directory_iterator(std::shared_ptr<_Dir>, error_code*)): Remove.
	(directory_iterator(const path&, directory_options, error_code*)):
	Pass options to _Dir::advance and create non-end iterator on error.
	(recursive_directory_iterator(const path&, directory_options,
	error_code*)): Clear error_code on ignored error, create non-end
	iterator otherwise.
	(recursive_directory_iterator::increment): Pass _M_options to
	_Dir::advance.
	(recursive_directory_iterator::pop): Likewise.
	* testsuite/experimental/filesystem/iterators/directory_iterator.cc:
	New.
	* testsuite/experimental/filesystem/iterators/
	recursive_directory_iterator.cc: New.

From-SVN: r228042
2015-09-23 12:26:45 +01:00
Jonathan Wakely 2f1e8e7c47 Enable lightweight checks with _GLIBCXX_ASSERTIONS.
* doc/xml/manual/using.xml (_GLIBCXX_ASSERTIONS): Document.
	* doc/html/manual/using_macros.html: Regenerate.
	* include/bits/c++config: Define _GLIBCXX_ASSERTIONS when
	_GLIBCXX_DEBUG is defined. Disable std::string extern templates when
	(_GLIBCXX_EXTERN_TEMPLATE, __glibcxx_assert): Depend on
	_GLIBCXX_ASSERTIONS instead of _GLIBCXX_DEBUG.
	* include/debug/debug.h [!_GLIBCXX_DEBUG]: Define
	__glibcxx_requires_non_empty_range and __glibcxx_requires_nonempty.
	* include/backward/auto_ptr.h (auto_ptr::operator*,
	auto_ptr::operator->): Replace _GLIBCXX_DEBUG_ASSERT with
	__glibcxx_assert.
	* include/bits/basic_string.h (basic_string::operator[],
	basic_string::front, basic_string::back, basic_string::pop_back):
	Likewise.
	* include/bits/random.h
	(uniform_int_distribution::param_type::param_type,
	uniform_real_distribution::param_type::param_type,
	normal_distribution::param_type::param_type,
	gamma_distribution::param_type::param_type,
	bernoulli_distribution::param_type::param_type,
	binomial_distribution::param_type::param_type,
	geometric_distribution::param_type::param_type,
	negative_binomial_distribution::param_type::param_type,
	poisson_distribution::param_type::param_type,
	exponential_distribution::param_type::param_type): Likewise.
	* include/bits/regex.h (match_results::operator[],
	match_results::prefix, match_results::suffix): Likewise.
	* include/bits/regex.tcc (format, regex_iterator::operator++):
	Likewise.
	* include/bits/regex_automaton.tcc (_StateSeq::_M_clone): Likewise.
	* include/bits/regex_compiler.tcc (_Compiler::_Compiler,
	_Compiler::_M_insert_character_class_matcher): Likewise.
	* include/bits/regex_executor.tcc (_Executor::_M_dfs): Likewise.
	* include/bits/regex_scanner.tcc (_Scanner::_M_advance,
	_Scanner::_M_scan_normal): Likewise.
	* include/bits/shared_ptr_base.h (__shared_ptr::_M_reset,
	__shared_ptr::operator*): Likewise.
	* include/bits/stl_iterator_base_funcs.h (__advance): Likewise.
	* include/bits/unique_ptr.h (unique_ptr::operator*,
	unique_ptr::operator[]): Likewise.
	* include/experimental/fs_path.h (path::path(string_type, _Type),
	path::iterator::operator++, path::iterator::operator--,
	path::iterator::operator*): Likewise.
	* include/experimental/string_view (basic_string_view::operator[],
	basic_string_view::front, basic_string_view::back,
	basic_string_view::remove_prefix): Likewise.
	* include/ext/random (beta_distribution::param_type::param_type,
	normal_mv_distribution::param_type::param_type,
	rice_distribution::param_type::param_type,
	pareto_distribution::param_type::param_type,
	k_distribution::param_type::param_type,
	arcsine_distribution::param_type::param_type,
	hoyt_distribution::param_type::param_type,
	triangular_distribution::param_type::param_type,
	von_mises_distribution::param_type::param_type,
	hypergeometric_distribution::param_type::param_type,
	logistic_distribution::param_type::param_type): Likewise.
	* include/ext/vstring.h (__versa_string::operator[]): Likewise.
	* include/std/complex (polar): Likewise.
	* include/std/mutex [!_GTHREAD_USE_MUTEX_TIMEDLOCK]
	(timed_mutex::~timed_mutex, timed_mutex::unlock,
	(recursive_timed_mutex::~timed_mutex, recursive_timed_mutex::unlock):
	Likewise.
	* include/std/shared_mutex [!PTHREAD_RWLOCK_INITIALIZER]
	(__shared_mutex_pthread::__shared_mutex_pthread,
	__shared_mutex_pthread::~__shared_mutex_pthread): Likewise.
	(__shared_mutex_pthread::lock, __shared_mutex_pthread::try_lock,
	__shared_mutex_pthread::unlock, __shared_mutex_pthread::lock_shared,
	__shared_mutex_pthread::try_lock_shared): Likewise.
	(__shared_mutex_cv::~__shared_mutex_cv, __shared_mutex_cv::unlock,
	__shared_mutex_cv::unlock_shared): Likewise.
	(shared_timed_mutex::try_lock_until,
	shared_timed_mutex::try_lock_shared_until): Likewise.
	* include/std/valarray (valarray::valarray(const _Tp*, size_t),
	valarray::operator=, valarray::sum, valarray::min, valarray::max,
	_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT, _DEFINE_BINARY_OPERATOR):
	Likewise.

From-SVN: r227595
2015-09-09 18:12:47 +01:00
Jonathan Wakely eb8bf686b7 Make std::experimental::not_fn SFINAE-friendly.
PR libstdc++/66998
	* include/experimental/functional (_Not_fn): Add exception
	specifications and non-deduced return types.
	(not_fn): Add exception specification and wrap pointer-to-member.
	* testsuite/experimental/functional/not_fn.cc: Test in SFINAE context
	and test pointer-to-member.

From-SVN: r227448
2015-09-03 15:36:03 +01:00
Jonathan Wakely 89f0694859 any (__any_caster): Define at namespace scope so the name is visible to name lookup.
* include/experimental/any (__any_caster): Define at namespace scope
	so the name is visible to name lookup.
	* testsuite/experimental/any/misc/any_cast_neg.cc: Adjust dg-error.

From-SVN: r227042
2015-08-20 21:19:58 +01:00
Jonathan Wakely 2548a4d6ba any (any::operator=(const any&)): Move check for self-assignment.
* include/experimental/any (any::operator=(const any&)): Move check
	for self-assignment.
	(any::operator=(any&&)): Add check for self-assignment.
	(any::operator=(_ValueType&&)): Constrain template argument.
	(any::swap(any&)): Add check for self-swap.
	* testsuite/experimental/any/assign/self.cc: Test move and swap.
	* testsuite/experimental/any/misc/any_cast_neg.cc: Update dg-error.

From-SVN: r226894
2015-08-14 12:51:18 +01:00