Commit Graph

4242 Commits

Author SHA1 Message Date
Jonathan Wakely adba76a391 Add tests for std::remove_cvref
* testsuite/20_util/remove_cvref/requirements/alias_decl.cc: New.
	* testsuite/20_util/remove_cvref/requirements/explicit_instantiation.cc:
	New.
	* testsuite/20_util/remove_cvref/value.cc: New.
	* testsuite/20_util/remove_cvref/value_ext.cc: New.

From-SVN: r259896
2018-05-03 16:12:19 +01:00
Jonathan Wakely 852ee53c27 PR libstdc++/84087 add default arguments to basic_string members (LWG 2268)
This change was a DR against C++11 and so should have been implemented
years ago.

	PR libstdc++/84087 LWG DR 2268 basic_string default arguments
	* include/bits/basic_string.h [_GLIBCXX_USE_CXX11_ABI=1]
	(append(const basic_string&, size_type, size_type)
	(assign(const basic_string&, size_type, size_type)
	(insert(size_type, const basic_string&, size_type, size_type)
	(replace(size_type,size_type,const basic_string&,size_type,size_type)
	(compare(size_type,size_type,constbasic_string&,size_type,size_type)):
	Add default arguments (LWG 2268).
	[_GLIBCXX_USE_CXX11_ABI=0]
	(append(const basic_string&, size_type, size_type)
	(assign(const basic_string&, size_type, size_type)
	(insert(size_type, const basic_string&, size_type, size_type)
	(replace(size_type,size_type,const basic_string&,size_type,size_type)
	(compare(size_type,size_type,constbasic_string&,size_type,size_type)):
	Likewise.
	* testsuite/21_strings/basic_string/dr2268.cc: New test.

From-SVN: r259895
2018-05-03 16:01:20 +01:00
Jonathan Wakely d49b342694 PR libstdc++/84535 constrain std::thread constructor
The standard requires that the std::thread constructor is constrained so
it can't be called with a first argument of type std::thread. The
current implementation only meets that requirement if the constructor is
called with one argument, by using deleted overloads. This uses an
enable_if constraint to enforce the requirement for any number of
arguments.

Also add a static assertion to give a more readable error for invalid
arguments that cannot be invoked. Also simplify _Invoker to reduce the
error cascade for ill-formed instantiations with non-invocable
arguments.

	PR libstdc++/84535
	* include/std/thread (thread::__not_same): New SFINAE helper.
	(thread::thread(_Callable&&, _Args&&...)): Add SFINAE constraint that
	first argument is not a std::thread. Add static assertion to check
	INVOKE expression is valid.
	(thread::thread(thread&), thread::thread(const thread&&)): Remove.
	(thread::_Invoke::_M_invoke, thread::_Invoke::operator()): Use
	__invoke_result for return types and remove exception specifications.
	* testsuite/30_threads/thread/cons/84535.cc: New.

From-SVN: r259893
2018-05-03 15:08:36 +01:00
François Dumont 27db01d803 deque.tcc (deque<>::_M_assign_aux): Cast to void to ensure overloaded comma not used.
2018-05-02  François Dumont  <fdumont@gcc.gnu.org>

	* include/bits/deque.tcc (deque<>::_M_assign_aux): Cast to void to
	ensure overloaded comma not used.
	* include/bits/list.tcc (list<>::_M_assign_dispatch): Likewise.
	* include/bits/vector.tcc (vector<>::_M_assign_aux): Likewise.
	* include/bits/stl_bvector.h (vector<bool>::_M_assign_aux): Likewise.
	* testsuite/23_containers/deque/modifiers/assign/1.cc: New.
	* testsuite/23_containers/list/modifiers/assign/1.cc: New.
	* testsuite/23_containers/vector/bool/modifiers/assign/1.cc: New.
	* testsuite/23_containers/vector/modifiers/assign/1.cc: New.

From-SVN: r259856
2018-05-02 19:51:33 +00:00
Jonathan Wakely 85d0fad469 PR libstdc++/68197 fail on negative iword/pword indices
The suggested resolution of LWG 3083 is to make invalid indices
undefined, but we can fairly easily check for them and treat them as
errors in the same way as allocation failure. This avoids a segfault or
worse, setting an error flag on the stream instead.

	PR libstdc++/68197
	* include/bits/ios_base.h (ios_base::iword, ios_base::pword): Cast
	indices to unsigned.
	* src/c++11/ios.cc (ios_base::_M_grow_words): Treat negative indices
	as failure. Refactor error handling.
	* testsuite/27_io/ios_base/storage/68197.cc: New.

From-SVN: r259854
2018-05-02 20:04:55 +01:00
Jonathan Wakely 1b749ae95e PR libstdc++/83860 avoid dangling references in valarray closure types
Store nested closures by value not by reference, to prevent holding
invalid references to temporaries that have been destroyed. This
changes the layout of the closure types, so change their linkage names,
but moving them to a different namespace.

	PR libstdc++/57997
	PR libstdc++/83860
	* include/bits/gslice_array.h (gslice_array): Define default
	constructor as deleted, as per C++11 standard.
	* include/bits/mask_array.h (mask_array): Likewise.
	* include/bits/slice_array.h (slice_array): Likewise.
	* include/bits/valarray_after.h (_GBase, _GClos, _IBase, _IClos): Move
	to namespace __detail.
	(_GBase::_M_expr, _IBase::_M_expr): Use _ValArrayRef for type of data
	members.
	* include/bits/valarray_before.h (_ValArrayRef): New helper for type
	of data members in closure objects.
	(_FunBase, _ValFunClos, _RefFunClos, _UnBase, _UnClos, _BinBase)
	(_BinBase2, _BinBase1, _BinClos, _SBase, _SClos): Move to namespace
	__detail.
	(_FunBase::_M_expr, _UnBase::_M_expr, _BinBase::_M_expr1)
	(_BinBase::_M_expr2, _BinBase2::_M_expr1, _BinBase1::_M_expr2)
	(_SBase::_M_expr): Use _ValArrayRef for type of data members.
	* include/std/valarray (_UnClos, _BinClos, _SClos, _GClos, _IClos)
	(_ValFunClos, _RefFunClos): Move to namespace __detail and add
	using-declarations to namespace std.
	* testsuite/26_numerics/valarray/83860.cc: New.

From-SVN: r259844
2018-05-02 17:41:46 +01:00
Jonathan Wakely 59bcf90013 Remove duplicate function call in test
* testsuite/backward/strstream_move.cc: Remove duplicate function
	call.

From-SVN: r259843
2018-05-02 17:27:01 +01:00
Jonathan Wakely c6d4257972 PR libstdc++/69608 Move semantics for strstreambuf
In libstdc++ the deprecated char* streams are non-copyable, as was
required pre-C++11.

Since C++11 the standard implies that those streams should be copyable,
but doesn't specify the effects of copying them. This is surely a
defect, so for consistency with other implementations this change makes
them movable, but not copyable.

	PR libstdc++/69608
	* include/backward/strstream (strstreambuf): Define move constructor
	and move assignment operator.
	(istrstream, ostrstream, strstream): Likewise.
	* testsuite/backward/strstream_move.cc: New.

From-SVN: r259842
2018-05-02 17:25:44 +01:00
Jonathan Wakely 8cc8789fb4 PR libstdc++/84442 if _Exit isn't declared then use _exit instead
PR libstdc++/84442
	* testsuite/30_threads/thread/cons/terminate.cc
	[!_GLIBCXX_USE_C99_STDLIB] : Use _exit or std::exit instead of _Exit.

From-SVN: r259463
2018-04-18 12:15:38 +01:00
Jonathan Wakely ef0e80d23c Make Filesystem TS tests pass in C++17 mode
The <testsuite_fs.h> header defaults to using std::filesystem in C++17
mode. The Filesystem TS tests need to define the macro that causes
std::experimental::filesystem to be used instead.

	* testsuite/experimental/filesystem/file_status/1.cc: Add
	-DUSE_FILESYSTEM_TS to dg-options.
	* testsuite/experimental/filesystem/iterators/directory_iterator.cc:
	Likewise.
	* testsuite/experimental/filesystem/iterators/pop.cc: Likewise.
	* testsuite/experimental/filesystem/iterators/
	recursive_directory_iterator.cc: Likewise.
	* testsuite/experimental/filesystem/operations/absolute.cc: Likewise.
	* testsuite/experimental/filesystem/operations/canonical.cc: Likewise.
	* testsuite/experimental/filesystem/operations/copy.cc: Likewise.
	* testsuite/experimental/filesystem/operations/copy_file.cc: Likewise.
	* testsuite/experimental/filesystem/operations/create_directories.cc:
	Likewise.
	* testsuite/experimental/filesystem/operations/create_directory.cc:
	Likewise.
	* testsuite/experimental/filesystem/operations/create_symlink.cc:
	Likewise.
	* testsuite/experimental/filesystem/operations/current_path.cc:
	Likewise.
	* testsuite/experimental/filesystem/operations/equivalent.cc: Likewise.
	* testsuite/experimental/filesystem/operations/exists.cc: Likewise.
	* testsuite/experimental/filesystem/operations/file_size.cc: Likewise.
	* testsuite/experimental/filesystem/operations/is_empty.cc: Likewise.
	* testsuite/experimental/filesystem/operations/last_write_time.cc:
	Likewise.
	* testsuite/experimental/filesystem/operations/permissions.cc:
	Likewise.
	* testsuite/experimental/filesystem/operations/read_symlink.cc:
	Likewise.
	* testsuite/experimental/filesystem/operations/remove.cc: Likewise.
	* testsuite/experimental/filesystem/operations/remove_all.cc: Likewise.
	* testsuite/experimental/filesystem/operations/status.cc: Likewise.
	* testsuite/experimental/filesystem/operations/temp_directory_path.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/append/path.cc: Likewise.
	* testsuite/experimental/filesystem/path/assign/assign.cc: Likewise.
	* testsuite/experimental/filesystem/path/assign/copy.cc: Likewise.
	* testsuite/experimental/filesystem/path/compare/compare.cc: Likewise.
	* testsuite/experimental/filesystem/path/compare/path.cc: Likewise.
	* testsuite/experimental/filesystem/path/compare/strings.cc: Likewise.
	* testsuite/experimental/filesystem/path/concat/path.cc: Likewise.
	* testsuite/experimental/filesystem/path/concat/strings.cc: Likewise.
	* testsuite/experimental/filesystem/path/construct/copy.cc: Likewise.
	* testsuite/experimental/filesystem/path/construct/default.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/construct/locale.cc: Likewise.
	* testsuite/experimental/filesystem/path/construct/range.cc: Likewise.
	* testsuite/experimental/filesystem/path/construct/string_view.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/decompose/extension.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/decompose/filename.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/decompose/parent_path.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/decompose/relative_path.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/decompose/root_directory.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/decompose/root_name.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/decompose/root_path.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/decompose/stem.cc: Likewise.
	* testsuite/experimental/filesystem/path/generic/generic_string.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/itr/traversal.cc: Likewise.
	* testsuite/experimental/filesystem/path/modifiers/clear.cc: Likewise.
	* testsuite/experimental/filesystem/path/modifiers/make_preferred.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/modifiers/remove_filename.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/modifiers/replace_extension.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/modifiers/replace_filename.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/modifiers/swap.cc: Likewise.
	* testsuite/experimental/filesystem/path/native/string.cc: Likewise.
	* testsuite/experimental/filesystem/path/nonmember/hash_value.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/query/empty.cc: Likewise.
	* testsuite/experimental/filesystem/path/query/has_extension.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/query/has_filename.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/query/has_parent_path.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/query/has_relative_path.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/query/has_root_directory.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/query/has_root_name.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/query/has_root_path.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/query/has_stem.cc: Likewise.
	* testsuite/experimental/filesystem/path/query/is_relative.cc:
	Likewise.

From-SVN: r259396
2018-04-16 09:24:40 +01:00
Jonathan Wakely 5f30251862 PR libstdc++/85222 allow catching iostream errors as gcc4-compatible ios::failure
Define a new exception type derived from std::ios::failure[abi:cxx11]
which also aggregates an object of the gcc4-compatible ios::failure
type. Make __throw_ios_failure throw this new type for iostream errors
that raise exceptions. Provide custom type info for the new type so that
it can be caught by handlers for the gcc4-compatible ios::failure type
as well as handlers for ios::failure[abi:cxx11] and its bases.

	PR libstdc++/85222
	* src/c++11/Makefile.am [ENABLE_DUAL_ABI]: Add special rules for
	cxx11-ios_failure.cc to rewrite type info for __ios_failure.
	* src/c++11/Makefile.in: Regenerate.
	* src/c++11/cxx11-ios_failure.cc (__ios_failure, __iosfail_type_info):
	New types.
	[_GLIBCXX_USE_DUAL_ABI] (__throw_ios_failure): Define here.
	* src/c++11/ios.cc (__throw_ios_failure): Remove definition.
	* src/c++98/ios_failure.cc (__construct_ios_failure)
	(__destroy_ios_failure, is_ios_failure_handler): New functions.
	[!_GLIBCXX_USE_DUAL_ABI] (__throw_ios_failure): Define here.
	* testsuite/27_io/ios_base/failure/dual_abi.cc: New.
	* testsuite/27_io/basic_ios/copyfmt/char/1.cc: Revert changes to
	handler types, to always catch std::ios_base::failure.
	* testsuite/27_io/basic_ios/exceptions/char/1.cc: Likewise.
	* testsuite/27_io/basic_istream/extractors_arithmetic/char/
	exceptions_failbit.cc: Likewise.
	* testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/
	exceptions_failbit.cc: Likewise.
	* testsuite/27_io/basic_istream/extractors_other/char/
	exceptions_null.cc: Likewise.
	* testsuite/27_io/basic_istream/extractors_other/wchar_t/
	exceptions_null.cc: Likewise.
	* testsuite/27_io/basic_istream/sentry/char/12297.cc: Likewise.
	* testsuite/27_io/basic_istream/sentry/wchar_t/12297.cc: Likewise.
	* testsuite/27_io/basic_ostream/inserters_other/char/
	exceptions_null.cc: Likewise.
	* testsuite/27_io/basic_ostream/inserters_other/wchar_t/
	exceptions_null.cc: Likewise.
	* testsuite/27_io/ios_base/storage/2.cc: Likewise.

From-SVN: r259281
2018-04-10 15:36:09 +01:00
Jonathan Wakely c73847e77b PR libstdc++/85183 fix std::variant move-assignment
PR libstdc++/85183
	* include/std/variant (_Move_assign_base::operator=): Fix incorrect
	value categories.
	* testsuite/20_util/variant/85183.cc: New.

From-SVN: r259059
2018-04-04 00:03:07 +01:00
Jonathan Wakely 7c69a7d9bd PR libstdc++/85040 fix std::less<void> etc. ambiguities
PR libstdc++/85040
	* include/bits/stl_function.h (greater::__not_overloaded)
	(less::__not_overloaded, greater_equal::__not_overloaded)
	(less_equal::__not_overloaded): Fix ambiguous specializations.
	* testsuite/20_util/function_objects/comparisons_pointer.cc: Add
	tests for type with overlaoded operators.

From-SVN: r258773
2018-03-22 14:23:27 +00:00
Rainer Orth 83872062cb xfail experimental/memory_resource/resource_adaptor.cc on 32-bit Solaris/x86 (PR libstdc++/77691)
PR libstdc++/77691
	* testsuite/experimental/memory_resource/resource_adaptor.cc:
	xfail execution on 32-bit Solaris/x86.

From-SVN: r258766
2018-03-22 13:33:29 +00:00
Jonathan Wakely 5a0729f5a4 Fix some libstdc++ testsuite failures
* testsuite/20_util/function_objects/comparisons_pointer.cc: Use
	VERIFY instead of assert.
	* testsuite/20_util/hash/84998.cc: New test.
	* testsuite/23_containers/vector/cons/destructible_debug_neg.cc: New
	copy of test adjusted for Debug Mode.
	* testsuite/23_containers/vector/cons/destructible_neg.cc: Do not run
	test in Debug Mode.

From-SVN: r258714
2018-03-21 12:32:14 +00:00
Jonathan Wakely 0fb9dc36d2 Fix new test that fails in C++98 mode
* testsuite/20_util/function_objects/comparisons_pointer.cc: Adjust
	to compile as C++98.

From-SVN: r258623
2018-03-17 13:44:16 +00:00
Jonathan Wakely 0b3ec8f48f PR libstdc++/78420 Make std::less etc. yield total order for pointers
In order for std::less<T*> etc. to meet the total order requirements of
[comparisons] p2 we need to cast unrelated pointers to uintptr_t before
comparing them. Those casts aren't allowed in constant expressions, so
only cast when __builtin_constant_p says the result of the comparison is
not a compile-time constant (because the arguments are not constants, or
the result of the comparison is unspecified). When the result is
constant just compare the pointers directly without casting.

This ensures that the function can be called in constant expressions
with suitable arguments, but still yields a total order even for
otherwise unspecified pointer comparisons.

For std::less<void> etc. add new overloads for pointers, which use
std::less<common_type_t<T*,U*>> directly. Also change the generic
overloads to detect when the comparison would call a built-in relational
operator with pointer operands, and dispatch that case to the
corresponding specialization for void pointers.

	PR libstdc++/78420
	* include/bits/stl_function.h (greater<_Tp*>, less<_Tp*>)
	(greater_equal<_Tp*>, less_equal<_Tp>*): Add partial specializations
	to ensure total order for pointers.
	(greater<void>, less<void>, greater_equal<void>, less_equal<void>):
	Add operator() overloads for pointer arguments and make generic
	overloads dispatch to new _S_cmp functions when comparisons would
	use built-in operators for pointers.
	* testsuite/20_util/function_objects/comparisons_pointer.cc: New.

From-SVN: r258540
2018-03-14 23:02:01 +00:00
Jonathan Wakely 97ca95ac6f PR libstdc++/84773 use aligned alloc functions for FreeBSD and MinGW cross-compilers
PR libstdc++/84773
	PR libstdc++/83662
	* crossconfig.m4: Check for aligned_alloc etc. on freebsd and mingw32.
	* configure: Regenerate.
	* include/c_global/cstdlib [_GLIBCXX_HAVE_ALIGNED_ALLOC]
	(aligned_alloc): Add using-declaration.
	* testsuite/18_support/aligned_alloc/aligned_alloc.cc: New test.

From-SVN: r258468
2018-03-12 22:52:16 +00:00
François Dumont fe6bd21a0b printers.py (NodeIteratorPrinter): New.
2018-03-08  François Dumont  <fdumont@gcc.gnu.org>

	* python/libstdcxx/v6/printers.py (NodeIteratorPrinter): New.
	(StdListIteratorPrinter): Inherit from latter.
	(StdFwdListIteratorPrinter): New, inherit from latter.
	(StdDebugIteratorPrinter.to_string): Use non-debug iterator printer
	when iterator has no associated container.
	(build_libstdcxx_dictionary): Add __gnu_cxx::_Fwd_list_iterator and
	__gnu_cxx::_Fwd_list_const_iterator printers. Remove __norm namespace
	registrations.
	* testsuite/libstdc++-prettyprinters/debug.cc: Adapt.
	* testsuite/libstdc++-prettyprinters/debug_cxx11.cc: Adapt.

From-SVN: r258350
2018-03-08 06:26:15 +00:00
Ville Voutilainen 447346e465 re PR libstdc++/84601 (std::optional<std::pair<int, int>> is not assignment copyable)
PR libstdc++/84601
* include/std/optional (_Optional_payload): Split into multiple
specializations that can handle different cases of trivial or
non-trivial assignment operators.
* testsuite/20_util/optional/84601.cc: New.
* testsuite/20_util/optional/cons/value_neg.cc: Adjust.

From-SVN: r258304
2018-03-06 23:43:03 +02:00
Jonathan Wakely 2f03003dcc PR libstdc++/84671 handle digit separators in duration literals
PR libstdc++/84671
	* include/bits/parse_numbers.h (_Number_help): Add partial
	specialization to handle digit separators. Adjust partial
	specialization for recursion temrination to require _Pow == 1ULL.
	* testsuite/20_util/duration/literals/84671.cc: New

From-SVN: r258157
2018-03-02 20:38:50 +00:00
Ville Voutilainen 23c3a05908 Implement the missing bits of LWG 2769
* include/std/any (any_cast(const any&)): Add static_assert.
(any_cast(any&)): Likewise.
(any_cast(any&&)): Likewise, and remove the handling
for copyable-but-not-movable type.
* testsuite/20_util/any/misc/any_cast.cc: Adjust.
* testsuite/20_util/any/misc/any_cast_neg.cc: Likewise, and
add new tests.

From-SVN: r258031
2018-02-27 13:33:30 +02:00
Jonathan Wakely cc53514672 PR libstdc++/84532 prevent unwrapping of reference_wrapper arguments
PR libstdc++/84532
	* include/std/thread (thread::__make_invoker): Construct tuple
	directly instead of using make_tuple.
	* testsuite/30_threads/async/84532.cc: New.
	* testsuite/30_threads/thread/84532.cc: New.

From-SVN: r257956
2018-02-23 23:23:43 +00:00
Jonathan Wakely 670a8d7497 Remove duplicate "//" in comment
From-SVN: r257147
2018-01-29 14:09:52 +00:00
Jonathan Wakely 50ea03f403 PR libstdc++/83833 fix failing test on ia32
PR libstdc++/83833
	* testsuite/26_numerics/random/chi_squared_distribution/83833.cc:
	Add -ffloat-store to options for m68k and ia32.

From-SVN: r257146
2018-01-29 14:07:27 +00:00
Jonathan Wakely 73ebece382 PR libstdc++/83658 fix exception-safety in std::any::emplace
PR libstdc++/83658
	* include/std/any (any::__do_emplace): Only set _M_manager after
	constructing the contained object.
	* testsuite/20_util/any/misc/any_cast_neg.cc: Adjust dg-error line.
	* testsuite/20_util/any/modifiers/83658.cc: New test.

From-SVN: r257141
2018-01-29 12:33:32 +00:00
Jonathan Wakely 58078de77b PR libstdc++/81076 make __byte_operand SFINAE-friendly
PR libstdc++/81076
	* include/c_global/cstddef (__byte_operand): Define primary template.
	* testsuite/18_support/byte/81076.cc: New test.

From-SVN: r257050
2018-01-25 15:24:39 +00:00
Christophe Lyon a46c4287bb [libstdc++][testsuite] Fix dg-options/dg-add-options order
2018-01-19  Christophe Lyon  <christophe.lyon@linaro.org>

	* testsuite/ext/special_functions/airy_ai/check_nan.cc: Fix
          dg-options and dg-add-options order.
	* testsuite/ext/special_functions/airy_bi/check_nan.cc: Likewise.
	* testsuite/ext/special_functions/conf_hyperg/check_nan.cc:
	Likewise.
	* testsuite/ext/special_functions/hyperg/check_nan.cc: Likewise.
	* testsuite/special_functions/01_assoc_laguerre/check_nan.cc:
	Likewise.
	* testsuite/special_functions/02_assoc_legendre/check_nan.cc:
	Likewise.
	* testsuite/special_functions/03_beta/check_nan.cc: Likewise.
	* testsuite/special_functions/04_comp_ellint_1/check_nan.cc:
	Likewise.
	* testsuite/special_functions/05_comp_ellint_2/check_nan.cc:
	Likewise.
	* testsuite/special_functions/06_comp_ellint_3/check_nan.cc:
	Likewise.
	* testsuite/special_functions/06_comp_ellint_3/pr66689.cc:
	Likewise.
	* testsuite/special_functions/07_cyl_bessel_i/check_nan.cc:
	Likewise.
	* testsuite/special_functions/08_cyl_bessel_j/check_nan.cc:
	Likewise.
	* testsuite/special_functions/09_cyl_bessel_k/check_nan.cc:
	Likewise.
	* testsuite/special_functions/10_cyl_neumann/check_nan.cc:
	Likewise.
	* testsuite/special_functions/11_ellint_1/check_nan.cc: Likewise.
	* testsuite/special_functions/12_ellint_2/check_nan.cc: Likewise.
	* testsuite/special_functions/13_ellint_3/check_nan.cc: Likewise.
	* testsuite/special_functions/13_ellint_3/pr66689.cc: Likewise.
	* testsuite/special_functions/14_expint/check_nan.cc: Likewise.
	* testsuite/special_functions/15_hermite/check_nan.cc: Likewise.
	* testsuite/special_functions/16_laguerre/check_nan.cc: Likewise.
	* testsuite/special_functions/17_legendre/check_nan.cc: Likewise.
	* testsuite/special_functions/18_riemann_zeta/check_nan.cc:
	Likewise.
	* testsuite/special_functions/19_sph_bessel/check_nan.cc:
	Likewise.
	* testsuite/special_functions/20_sph_legendre/check_nan.cc:
	Likewise.
	* testsuite/special_functions/21_sph_neumann/check_nan.cc:
	Likewise.

From-SVN: r256879
2018-01-19 11:17:34 +01:00
Eric Botcazou 229433c94f * testsuite/17_intro/names.cc: Undefine 'y' on SPARC/Linux.
From-SVN: r256754
2018-01-16 20:40:09 +00:00
Jonathan Wakely 8b3085e7e8 PR libstdc++/83833 fix chi_squared_distribution::param(const param&)
PR libstdc++/83833
	* include/bits/random.h (chi_squared_distribution::param): Update
	gamma distribution parameter.
	* testsuite/26_numerics/random/chi_squared_distribution/83833.cc: New
	test.

From-SVN: r256708
2018-01-15 19:58:22 +00:00
Jonathan Wakely b0e63d9483 PR libstdc++/83830 Define std::has_unique_object_representations_v
PR libstdc++/83830
	* include/std/type_traits (has_unique_object_representations_v): Add
	variable template.
	* testsuite/20_util/has_unique_object_representations/value.cc: Check
	variable template.

From-SVN: r256701
2018-01-15 15:02:01 +00:00
Ville Voutilainen c89f2d2468 Make optional conditionally trivially_{copy,move}_{constructible,assignable}
* include/std/optional (_Optional_payload): Fix the comment in
the class head and turn into a primary and one specialization.
(_Optional_payload::_M_engaged): Strike the NSDMI.
(_Optional_payload<_Tp, false>::operator=(const _Optional_payload&)):
New.
(_Optional_payload<_Tp, false>::operator=(_Optional_payload&&)):
Likewise.
(_Optional_payload<_Tp, false>::_M_get): Likewise.
(_Optional_payload<_Tp, false>::_M_reset): Likewise.
(_Optional_base_impl): Likewise.
(_Optional_base): Turn into a primary and three specializations.
(optional(nullopt)): Change the base init.
* testsuite/20_util/optional/assignment/8.cc: New.
* testsuite/20_util/optional/cons/trivial.cc: Likewise.
* testsuite/20_util/optional/cons/value_neg.cc: Adjust.

From-SVN: r256694
2018-01-15 13:32:24 +02:00
Jonathan Wakely bab0a26de5 PR libstdc++/80276 fix template argument handling in type printers
PR libstdc++/80276
	* python/libstdcxx/v6/printers.py (strip_inline_namespaces): New.
	(get_template_arg_list): New.
	(StdVariantPrinter._template_args): Remove, use get_template_arg_list
	instead.
	(TemplateTypePrinter): Rewrite to work with gdb.Type objects instead
	of strings and regular expressions.
	(add_one_template_type_printer): Adapt to new TemplateTypePrinter.
	(FilteringTypePrinter): Add docstring. Match using startswith. Use
	strip_inline_namespaces instead of strip_versioned_namespace.
	(add_one_type_printer): Prepend namespace to match argument.
	(register_type_printers): Add type printers for char16_t and char32_t
	string types and for types using cxx11 ABI. Update calls to
	add_one_template_type_printer to provide default argument dicts.
	* testsuite/libstdc++-prettyprinters/80276.cc: New test.
	* testsuite/libstdc++-prettyprinters/whatis.cc: Remove tests for
	basic_string<unsigned char> and basic_string<signed char>.
	* testsuite/libstdc++-prettyprinters/whatis2.cc: Duplicate whatis.cc
	to test local variables, without overriding _GLIBCXX_USE_CXX11_ABI.

From-SVN: r256689
2018-01-15 11:13:53 +00:00
Tim Shen 8532713fc4 re PR libstdc++/83601 (std::regex_replace C++14 conformance issue: escaping in SED mode)
PR libstdc++/83601
	* include/bits/regex.tcc (regex_replace): Fix escaping in sed.
	* testsuite/28_regex/algorithms/regex_replace/char/pr83601.cc: Tests.
	* testsuite/28_regex/algorithms/regex_replace/wchar_t/pr83601.cc: Tests.

From-SVN: r256654
2018-01-14 00:48:30 +00:00
Rainer Orth c969e34e3f Link with correct values-*.o files on Solaris (PR target/40411)
gcc/testsuite:
	PR libfortran/67412
	* gfortran.dg/execute_command_line_2.f90: Remove dg-xfail-run-if
	on *-*-solaris2.10.

	libstdc++-v3:
	PR libstdc++/64054
	* testsuite/27_io/basic_ostream/inserters_arithmetic/char/hexfloat.cc:
	Remove dg-xfail-run-if.

	gcc:
	PR target/40411
	* config/sol2.h (STARTFILE_ARCH_SPEC): Don't use with -shared or
	-symbolic.
	Use values-Xc.o for -pedantic.
	Link with values-xpg4.o for C90, values-xpg6.o otherwise.

From-SVN: r256568
2018-01-12 09:52:53 +00:00
François Dumont 75ce74bbdd 2018-01-10 François Dumont <fdumont@gcc.gnu.org>
* include/bits/forward_list.h
	(_Fwd_list_node_base(_Fwd_list_node_base&&)): New.
	(_Fwd_list_node_base& operator=(_Fwd_list_node_base&&)): New.
	(_Fwd_list_node_base(const _Fwd_list_node_base&)): Explicit delete.
	(_Fwd_list_node_base& operator=(const _Fwd_list_node_base&)): Likewise.
	(_Fwd_list_impl()): Add noexcept qualification.
	(_Fwd_list_impl(const _Node_alloc_type&)): Delete.
	(_Fwd_list_impl(_Fwd_list_impl&&)): New, default.
	(_Fwd_list_impl(_Fwd_list_impl&&, _Node_alloc_type&&)): New.
	(_Fwd_list_base()): Default.
	(_Fwd_list_base(_Fwd_list_base&&, _Node_alloc_type&&, true_type)): New.
	(_Fwd_list_base(_Fwd_list_base&&)): Default.
	(forward_list<>()): Default.
	(forward_list<>(forward_list&&)): Default.
	(forward_list(forward_list&&, _Node_alloc_type&&, false_type)): New.
	(forward_list(forward_list&&, _Node_alloc_type&&, true_type)): New.
	(forward_list(forward_list&&, const _Alloc&)): Adapt to use latters.
	* include/bits/forward_list.tcc
	(_Fwd_list_base(_Fwd_list_base&&, _Node_alloc_type&&)): Adapt to use
	_M_impl._M_head move assignment.
	(forward_list<>::merge(forward_list<>&&, _Comp)): Likewise.
	* testsuite/23_containers/forward_list/allocator/default_init.cc: New.

From-SVN: r256439
2018-01-10 16:59:02 +00:00
Jonathan Wakely 8273aa77d4 PR libstdc++/80276 fix pretty printers for array smart pointers
PR libstdc++/80276
	* python/libstdcxx/v6/printers.py (SharedPointerPrinter)
	(UniquePointerPrinter): Print correct template argument, not type of
	the pointer.
	(TemplateTypePrinter._recognizer.recognize): Handle failure to lookup
	a type.
	* testsuite/libstdc++-prettyprinters/cxx11.cc: Test unique_ptr of
	array type.
	* testsuite/libstdc++-prettyprinters/cxx17.cc: Test shared_ptr and
	weak_ptr of array types.

From-SVN: r256400
2018-01-09 21:46:13 +00:00
François Dumont 0f1462579e re PR libstdc++/83709 (Inserting duplicates into an unordered associative containers causes the container to invalidate iterators)
2018-01-09  François Dumont  <fdumont@gcc.gnu.org>

	PR libstdc++/83709
	* include/bits/hashtable_policy.h
	(__distance_fwd(_Iterator, _Iterator, input_iterator_tag)): Return 1 if
	__first != __last.
	(_Insert_base::_M_insert_range(_Ite, _Ite, _NodeGetter, true_type)): New.
	(_Insert_base::_M_insert_range(_Ite, _Ite, _NodeGetter, false_type)):
	Add false_type parameter.
	(_Insert_base::insert): Adapt.
	* include/bits/hashtable.h (_Hashtable::operator=(initializzr_list<>)):
	Adapt.
	(_Hashtable::_M_insert(_Arg&&, const _NodeGen&, true_type, size_t)):
	 Add __n_elt parameter, defaulted to 1.
	(_Hashtable::_M_insert_unique_node): Likewise. Use it to call rehash
	policy _M_need_rehash.
	(_Hashtable::_M_merge_unique): Pass target number of elements to add to
	produce only 1 rehash if necessary.
	* testsuite/23_containers/unordered_map/insert/83709.cc: New.
	* testsuite/23_containers/unordered_set/insert/83709.cc: New.

From-SVN: r256396
2018-01-09 21:05:10 +00:00
Juraj Oršulić d2dfcf823c PR libstdc++/59253 Improve pretty printers for smart pointers
PR libstdc++/59253 (partial)
	* python/libstdcxx/v6/printers.py (SmartPtrIterator): Common iterator
	type for pointer stored by shared_ptr, weak_ptr and unique_ptr.
	(SharedPointerPrinter, UniquePointerPrinter): Treat stored values as
	children.
	* testsuite/libstdc++-prettyprinters/cxx11.cc: Update expected output
	of unique_ptr printer.
	* testsuite/libstdc++-prettyprinters/shared_ptr.cc: Update expected
	output of shared_ptr printer.

From-SVN: r256390
2018-01-09 18:49:57 +00:00
Jonathan Wakely 388058dd06 PR libstdc++/83626 handle ENOENT due to filesystem race
PR libstdc++/83626
	* src/filesystem/ops.cc (remove(const path&, error_code&)): Do not
	report an error for ENOENT.
	(remove_all(const path&)): Fix type of result variable.
	(remove_all(const path&, error_code&)): Use non-throwing increment
	for directory iterator. Call POSIX remove directly to avoid redundant
	calls to symlink_status. Do not report errors for ENOENT.
	* src/filesystem/std-ops.cc: Likewise.
	* testsuite/27_io/filesystem/operations/remove_all.cc: Test throwing
	overload.
	* testsuite/experimental/filesystem/operations/remove_all.cc:
	Likewise.

From-SVN: r256283
2018-01-05 18:02:18 +00:00
Jonathan Wakely 994844d36a PR libstdc++/83626 Don't throw for remove("") and remove_all("")
PR libstdc++/83626
	* src/filesystem/ops.cc (remove(const path&, error_code&))): Remove
	redundant call to ec.clear().
	(remove_all(const path&, error_code&))): Do not return an error for
	non-existent paths.
	* src/filesystem/std-ops.cc: Likewise.
	* testsuite/27_io/filesystem/operations/remove.cc: New test.
	* testsuite/27_io/filesystem/operations/remove_all.cc: Fix expected
	results for non-existent paths.
	* testsuite/experimental/filesystem/operations/remove.cc: New test.
	* testsuite/experimental/filesystem/operations/remove_all.cc: Fix
	expected results for non-existent paths.

From-SVN: r256269
2018-01-04 22:58:59 +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 ecba356686 PR libstdc++/83600 fix end iterator for unready std::match_results
PR libstdc++/83600
	* include/bits/regex.h (match_results::end()): Return valid iterator
	when not ready.
	* testsuite/28_regex/match_results/ctors/char/default.cc: Check that
	unready objects are empty and have equal begin and end iterators.
	* testsuite/28_regex/match_results/ctors/wchar_t/default.cc: Likewise.

From-SVN: r256014
2017-12-27 22:18:08 +00:00
Jonathan Wakely 8afe2df012 PR libstdc++/83598 don't modify flags passed to std::basic_regex constructors
PR libstdc++/83598
	* include/bits/regex.h (basic_regex): Don't modify flags passed to
	constructors.
	* testsuite/28_regex/basic_regex/ctors/83598.cc: New test.

From-SVN: r256013
2017-12-27 22:18:02 +00:00
Jonathan Wakely c41743d0c0 PR libstdc++/83538 fix std::match_results<T>::reference (LWG 2306)
PR libstdc++/83538
	* doc/xml/manual/intro.xml: Document LWG 2306 change.
	* include/bits/regex.h (match_results::reference): Change to
	non-const reference.
	* testsuite/28_regex/match_results/typedefs.cc: Check types are
	correct.

From-SVN: r256012
2017-12-27 19:43:33 +00:00
Michele Pezzutti 73986c315b re PR libstdc++/83237 (Values returned by std::poisson_distribution are not distributed correctly)
2017-12-24  Michele Pezzutti <mpezz@tiscali.it>

	PR libstdc++/83237
	* include/bits/random.tcc (poisson_distribution<>::operator()):
	Fix __x = 1 case - see updated Errata of Devroye's treatise.
	* testsuite/26_numerics/random/poisson_distribution/operators/
	values.cc: Add test.
	* testsuite/26_numerics/random/pr60037-neg.cc: Adjust dg-error
	line number.

From-SVN: r255993
2017-12-24 22:08:52 +00:00
Jonathan Wakely 4f9621392f PR libstdc++/83450 avoid -Wreturn-type warning in test
PR libstdc++/83450
	* testsuite/21_strings/basic_string/pthread18185.cc: Add return
	statement.

From-SVN: r255992
2017-12-24 09:17:38 +00:00
François Dumont 1679da1571 re PR libstdc++/82522 (std::map::insert(value_type &&) not selected)
2017-12-20  François Dumont  <fdumont@gcc.gnu.org>

	PR libstdc++/82522
	* include/debug/map.h (map::insert(value_type&&))
	(map::insert(const_iterator, value_type&&)): Add overload for rvalues.
	* include/debug/multimap.h (multimap::insert(value_type&&))
	(multimap::insert(const_iterator, value_type&&)): Likewise.
	* include/debug/unordered_map (unordered_map::insert(value_type&&))
	(unordered_map::insert(const_iterator, value_type&&))
	(unordered_multimap::insert(value_type&&))
	(unordered_multimap::insert(const_iterator, value_type&&)): Likewise.
	* testsuite/23_containers/map/modifiers/insert/dr2354.cc (test02): New.
	* testsuite/23_containers/multimap/modifiers/insert/dr2354.cc (test02):
	New.
	* testsuite/23_containers/unordered_map/insert/dr2354.cc (test02): New.
	* testsuite/23_containers/unordered_multimap/insert/dr2354.cc (test02):
	New.

From-SVN: r255904
2017-12-20 21:53:25 +00:00
Ville Voutilainen 5dd44f4ea5 re PR libstdc++/68430 (std::is_constructible<T>::value == true for unconstructible type T)
PR libstdc++/68430

* testsuite/20_util/is_constructible/68430.cc: New.

From-SVN: r255785
2017-12-18 20:46:30 +02:00
Jonathan Wakely 83fd5e73b3 PR libstdc++/68519 use native duration to avoid rounding errors
PR libstdc++/68519
	* include/std/condition_variable (condition_variable::wait_for):
	Convert duration to native clock's duration before addition.
	* testsuite/30_threads/condition_variable/members/68519.cc: New test.

From-SVN: r255665
2017-12-14 20:41:52 +00:00
Jonathan Wakely 00677c4877 PR libstdc++/83427 detect weak result type from noexcept functions
PR libstdc++/83427
	* include/bits/refwrap.h (_Maybe_unary_or_binary_function): Move here
	from <bits/std_function.h>.
	(_Mem_fn_traits_base, _Mem_fn_traits): Move here, from <functional>.
	(_Weak_result_type_impl, _Reference_wrapper_base): Deduce noexcept
	for function types. Remove partial specializations for member
	functions.
	(_Weak_result_type_impl): Remove unused partial specializations for
	non-referenceable function types and for references to functions.
	(_Weak_result_type_memfun, _Reference_wrapper_base_memfun): New
	helpers to handle member functions via _Mem_fn_traits.
	(_Weak_result_type, reference_wrapper): Derive from new helpers.
	* include/bits/std_function.h (_Maybe_unary_or_binary_function): Move
	to <bits/refwrap.h>.
	* include/std/functional (_Pack, _AllConvertible, _NotSame): Remove.
	(_Mem_fn_traits_base, _Mem_fn_traits): Move to <bits/refwrap.h>.
	* testsuite/20_util/bind/83427.cc: New test.
	* testsuite/20_util/bind/refqual.cc: Add noexcept to functions and
	check for weak result types.
	* testsuite/20_util/reference_wrapper/83427.cc: New test.

From-SVN: r255651
2017-12-14 17:18:22 +00:00
Jonathan Wakely f297ebafdc Test whitespace handling in std::complex extraction
* testsuite/26_numerics/complex/inserters_extractors/char/dr2714.cc:
	Add tests using noskipws.

From-SVN: r255632
2017-12-14 11:47:42 +00:00
Jonathan Wakely 02aee32767 Improve std::complex test and move to sub-directory
* testsuite/26_numerics/complex/dr2714.cc: Move to ...
	* testsuite/26_numerics/complex/inserters_extractors/char/dr2714.cc:
	... Here. Remove duplicate header and dg-options. Check first invalid
	character gets putback. Remove wchar_t test.

From-SVN: r255630
2017-12-14 11:28:41 +00:00
Jonathan Wakely 3ca652c199 PR libstdc++/59568 fix error handling for std::complex stream extraction
PR libstdc++/59568
	* include/std/complex (operator>>): Implement proposed resolution to
	LWG 2714. Use putback if and only if a character has been successfully
	extracted but isn't a delimiter. Use ctype::widen and traits::eq when
	testing if extracted characters match delimiters.
	* testsuite/26_numerics/complex/dr2714.cc: New test.

From-SVN: r255608
2017-12-13 17:02:14 +00:00
Jonathan Wakely 91d01b33e8 PR libstdc++/83395 fix invocable traits for INVOKE<cv void>
PR libstdc++/83395
	* include/std/type_traits (__is_invocable_impl): Remove partial
	specialization for INVOKE<void> and restore is_void<R> check in
	primary template.
	(__is_nt_invocable_impl): Likewise.
	* testsuite/20_util/is_invocable/83395.cc: New test.
	* testsuite/20_util/is_nothrow_invocable/83395.cc: New test.

From-SVN: r255584
2017-12-12 17:42:19 +00:00
David Edelsohn d3861707eb re PR libstdc++/83120 (ext/special_functions/hyperg failure on AIX)
PR libstdc++/83120
        * testsuite/ext/special_functions/hyperg/check_value.cc: Add
        -ffp-contract=off. Add -ffloat-store for m68* and ia32.
        * testsuite/tr1/5_numerical_facilities/special_functions/17_hyperg/check_value.cc: Same.

From-SVN: r255483
2017-12-07 15:05:59 -05:00
Jonathan Wakely 9ed83a33c0 Fix -Wunused warnings in libstdc++ headers
* config/io/basic_file_stdio.h (__basic_file): Remove name of unused
	parameter.
	* include/bits/boost_concept_check.h: Add pragmas to disable
	-Wunused-local-typedef warnings.
	* include/bits/codecvt.h (codecvt_byname<char16_t, char, mbstate_t>)
	(codecvt_byname<char32_t, char, mbstate_t>): Remove name of unused
	parameter.
	* include/bits/locale_facets_nonio.tcc (time_get::do_get_weekday)
	(time_get::do_get_monthname, time_get::do_get_year): Remove unused
	variables.
	* include/std/bitset (_Base_bitset<0>::_M_getword): Remove name of
	unused parameter.
	* include/std/streambuf (_IsUnused): Define.
	(basic_streambuf::imbue, basic_streambuf::pbackfail)
	(basic_streambuf::overflow): Add macro to unused parameters.
	* testsuite/24_iterators/operations/prev_neg.cc: Adjust dg-error.

From-SVN: r255391
2017-12-04 23:07:39 +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
Glen Joseph Fernandes 6b590c7a64 Move assertion from to_address to __to_address
2017-11-30  Glen Joseph Fernandes  <glenjofe@gmail.com>

	* include/bits/ptr_traits.h (__to_address, to_address): Move static
	assertion.
	* testsuite/20_util/to_address/1_neg.cc: New test.

From-SVN: r255277
2017-11-30 15:07:21 +00:00
Jonathan Wakely 5f939178ec PR libstdc++/83226 avoid forming pointer-to-reference type
PR libstdc++/83226
	* include/bits/node_handle.h (_Node_handle::__pointer): Avoid forming
	pointer-to-reference types.
	* testsuite/23_containers/map/modifiers/insert/83226.cc: New test.

From-SVN: r255271
2017-11-30 13:45:37 +00:00
David Malcolm 591996bad7 C++: improve location of static_assert errors
gcc/cp/ChangeLog:
	* parser.c (cp_parser_unary_expression): Generate a location for
	"noexcept".
	(cp_parser_trait_expr): Generate and return a location_t,
	converting the return type from tree to cp_expr.
	(cp_parser_static_assert): Pass location of the condition to
	finish_static_assert, rather than that of the "static_assert"
	token, where available.

gcc/testsuite/ChangeLog:
	* g++.dg/cpp1y/static_assert3.C: New test case.

libstdc++-v3/ChangeLog:
	* testsuite/20_util/duration/literals/range.cc: Update expected
	line of a static_assert failure.

From-SVN: r255255
2017-11-29 22:07:32 +00:00
Glen Joseph Fernandes 61cd19e6be Add std::to_address for C++2a (P0653R2)
2017-11-28  Glen Joseph Fernandes  <glenjofe@gmail.com>

	* include/bits/ptr_traits.h (to_address): Implement to_address.
	* testsuite/20_util/to_address/1.cc: New test.

From-SVN: r255199
2017-11-28 14:22:32 +00:00
Jonathan Wakely a8541d9021 Add [[nodiscard]] attribute to std::launder
* libsupc++/new (launder): Add nodiscard attribute.
	* testsuite/18_support/launder/nodiscard.cc: New test.

From-SVN: r255127
2017-11-24 00:00:46 +00:00
Jonathan Wakely d69f1ec7d1 Add [[nodiscard]] attribute to C++17 components
* include/bits/fs_path.h (path::empty): Add nodiscard attribute.
	* include/bits/range_access.h (empty): Likewise.
	* include/std/string_view (basic_string_view::empty): Likewise.
	* testsuite/21_strings/basic_string_view/capacity/empty_neg.cc: New
	test.
	* testsuite/24_iterators/range_access_cpp17_neg.cc: New test.
	* testsuite/27_io/filesystem/path/query/empty_neg.cc: New test.

From-SVN: r255124
2017-11-23 22:11:21 +00:00
Jonathan Wakely 4b9840f230 PR libstdc++/83134 Ensure std::__not_ converts B::value to bool
PR libstdc++/83134
	* include/std/type_traits (__not_): Explicitly convert to bool.
	* testsuite/20_util/declval/requirements/1_neg.cc: Adjust dg-error.
	* testsuite/20_util/logical_traits/83134.cc: New test.
	* testsuite/20_util/make_signed/requirements/typedefs_neg.cc: Adjust
	dg-error.
	* testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc:
	Likewise.

From-SVN: r255122
2017-11-23 21:35:27 +00:00
Jonathan Wakely 866e4d3853 PR libstdc++/48101 improve errors for invalid container specializations
PR libstdc++/48101
	* include/bits/allocator.h (allocator<const _Tp>)
	(allocator<volatile _Tp>, allocator<const volatile _Tp>): Add partial
	specializations.
	* include/bits/forward_list.h (forward_list): Add static assertions.
	* include/bits/hashtable.h (__cache_default): Use
	__is_nothrow_invocable instead of __is_noexcept_hash.
	(_Hashtable): Add static assertions.
	* include/bits/hashtable_policy.h (__is_noexcept_hash): Remove.
	* include/bits/stl_deque.h (deque): Add static assertions.
	* include/bits/stl_function.h (_Identity<const _Tp>): Add partial
	specialization.
	* include/bits/stl_list.h (list): Add static assertions.
	* include/bits/stl_map.h (map): Likewise.
	* include/bits/stl_multimap.h (multimap): Likewise.
	* include/bits/stl_multiset.h (multiset): Likewise.
	* include/bits/stl_set.h (set): Likewise.
	* include/bits/stl_tree.h (_Rb_tree): Likewise.
	* include/bits/stl_vector.h (vector): Likewise.
	* include/bits/unordered_map.h (unordered_map, unordered_multimap):
	Use typename instead of class in template-parameter-list and remove
	spaces.
	* include/bits/unordered_set.h (unordered_set, unordered_multiset):
	Likewise.
	* testsuite/23_containers/deque/48101-2_neg.cc: New test.
	* testsuite/23_containers/deque/48101_neg.cc: New test.
	* testsuite/23_containers/forward_list/48101-2_neg.cc: New test.
	* testsuite/23_containers/forward_list/48101_neg.cc: New test.
	* testsuite/23_containers/list/48101-2_neg.cc: New test.
	* testsuite/23_containers/list/48101_neg.cc: New test.
	* testsuite/23_containers/map/48101-2_neg.cc: New test.
	* testsuite/23_containers/map/48101_neg.cc: New test.
	* testsuite/23_containers/map/operations/31440.cc: Fix comparison
	object to have const-qualified call operator.
	* testsuite/23_containers/multimap/48101-2_neg.cc: New test.
	* testsuite/23_containers/multimap/48101_neg.cc: New test.
	* testsuite/23_containers/multiset/48101-2_neg.cc: New test.
	* testsuite/23_containers/multiset/48101_neg.cc: New test.
	* testsuite/23_containers/set/48101-2_neg.cc: New test.
	* testsuite/23_containers/set/48101_neg.cc: New test.
	* testsuite/23_containers/unordered_map/48101-2_neg.cc: New test.
	* testsuite/23_containers/unordered_map/48101_neg.cc: New test.
	* testsuite/23_containers/unordered_multimap/48101-2_neg.cc: New test.
	* testsuite/23_containers/unordered_multimap/48101_neg.cc: New test.
	* testsuite/23_containers/unordered_multiset/48101-2_neg.cc: New test.
	* testsuite/23_containers/unordered_multiset/48101_neg.cc: New test.
	* testsuite/23_containers/unordered_set/48101-2_neg.cc: New test.
	* testsuite/23_containers/unordered_set/48101_neg.cc: New test.
	* testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust
	dg-error line number.
	* testsuite/23_containers/vector/48101-2_neg.cc: New test.
	* testsuite/23_containers/vector/48101_neg.cc: New test.

From-SVN: r255035
2017-11-21 20:47:09 +00:00
François Dumont e324f9cb92 streambuf_iterator.h (istreambuf_iterator<>): Declare std::advance for istreambuf_iterator of char types to be friend.
2017-11-20  François Dumont  <fdumont@gcc.gnu.org>

	* include/bits/streambuf_iterator.h (istreambuf_iterator<>): Declare
	std::advance for istreambuf_iterator of char types to be friend.
	(std::advance(istreambuf_iterator&, _Distance)): New overload.
	* include/std/streambuf (basic_streambuf<>): Declare std::advance for
	istreambuf_iterator of char types to be friend.
	* testsuite/22_locale/money_get/get/char/9.cc: Have
	istreambuf_iterator created on the fly when calling money_get<>::get.
	* testsuite/22_locale/money_get/get/wchar_t/9.cc: Likewise.
	* testsuite/24_iterators/istreambuf_iterator/debug/1_neg.cc: New.
	* testsuite/24_iterators/istreambuf_iterator/debug/2_neg.cc: New.
	* testsuite/25_algorithms/advance/istreambuf_iterators/char/1.cc: New.
	* testsuite/25_algorithms/advance/istreambuf_iterators/char/1_neg.cc:
	New.
	* testsuite/25_algorithms/advance/istreambuf_iterators/char/2.cc: New.
	* testsuite/25_algorithms/advance/istreambuf_iterators/char/2_neg.cc:
	New.
	* testsuite/25_algorithms/advance/istreambuf_iterators/char/3_neg.cc:
	New.
	* testsuite/25_algorithms/advance/istreambuf_iterators/wchar_t/1.cc:
	New.
	* testsuite/25_algorithms/advance/istreambuf_iterators/wchar_t/1_neg.cc:
	New.
	* testsuite/25_algorithms/advance/istreambuf_iterators/wchar_t/2.cc:
	New.
	* testsuite/25_algorithms/advance/istreambuf_iterators/wchar_t/2_neg.cc:
	New.
	* testsuite/25_algorithms/advance/istreambuf_iterators/wchar_t/3_neg.cc:
	New.
	* testsuite/25_algorithms/find/istreambuf_iterators/char/2.cc: Leverage
	on std::advance overload.
	* testsuite/25_algorithms/find/istreambuf_iterators/wchar_t/2.cc:
	Likewise.

From-SVN: r254972
2017-11-20 22:30:28 +00:00
Jonathan Wakely 9be0a9d6d2 Fix failing tests caused by duplicate dg-options
* testsuite/special_functions/18_riemann_zeta/check_value.cc: Fix
	duplicate dg-options directive.
	* testsuite/tr1/5_numerical_facilities/special_functions/
	20_riemann_zeta/check_value_neg.cc: Likewise.

From-SVN: r254971
2017-11-20 21:48:31 +00:00
Ville Voutilainen 7b7b60c830 Implement LWG 2353
* include/bits/stl_iterator_base_funcs.h (next):
Use InputIterator instead of ForwardIterator.
* testsuite/24_iterators/operations/lwg2353.cc: New.
* testsuite/24_iterators/operations/next_neg.cc: Remove.

From-SVN: r254957
2017-11-20 16:21:42 +02:00
Edward Smith-Rowland b46881363f PR libstdc++/pr66689 - comp_ellint_3 and ellint_3 return garbage values
2017-11-18  Edward Smith-Rowland  <3dw4rd@verizon.net>

	PR libstdc++/pr66689 - comp_ellint_3 and ellint_3 return garbage values
	* include/tr1/ell_integral.tcc: Correct the nu sign convention
	in ellint_3 and comp_ellint_3.
	* testsuite/tr1/5_numerical_facilities/special_functions/
	06_comp_ellint_3/check_value.cc: Regen with correct values.
	* testsuite/tr1/5_numerical_facilities/special_functions/
	14_ellint_3/check_value.cc: Ditto.
	* testsuite/special_functions/06_comp_ellint_3/check_value.cc: Ditto.
	* testsuite/special_functions/13_ellint_3/check_value.cc: Ditto.
	* testsuite/tr1/5_numerical_facilities/special_functions/
	01_assoc_laguerre/check_value.cc: Regen.
	* testsuite/tr1/5_numerical_facilities/special_functions/
	02_assoc_legendre/check_value.cc: Regen.
	* testsuite/tr1/5_numerical_facilities/special_functions/
	03_beta/check_value.cc: Regen.
	* testsuite/tr1/5_numerical_facilities/special_functions/
	04_comp_ellint_1/check_value.cc: Regen.
	* testsuite/tr1/5_numerical_facilities/special_functions/
	05_comp_ellint_2/check_value.cc: Regen.
	* testsuite/tr1/5_numerical_facilities/special_functions/
	07_conf_hyperg/check_value.cc: Regen.
	* testsuite/tr1/5_numerical_facilities/special_functions/
	08_cyl_bessel_i/check_value.cc: Regen.
	* testsuite/tr1/5_numerical_facilities/special_functions/
	09_cyl_bessel_j/check_value.cc: Regen.
	* testsuite/tr1/5_numerical_facilities/special_functions/
	10_cyl_bessel_k/check_value.cc: Regen.
	* testsuite/tr1/5_numerical_facilities/special_functions/
	11_cyl_neumann/check_value.cc: Regen.
	* testsuite/tr1/5_numerical_facilities/special_functions/
	12_ellint_1/check_value.cc: Regen.
	* testsuite/tr1/5_numerical_facilities/special_functions/
	13_ellint_2/check_value.cc: Regen.
	* testsuite/tr1/5_numerical_facilities/special_functions/
	15_expint/check_value_neg.cc: Regen.
	* testsuite/tr1/5_numerical_facilities/special_functions/
	16_hermite/check_value.cc: Regen.
	* testsuite/tr1/5_numerical_facilities/special_functions/
	17_hyperg/check_value.cc: Regen.
	* testsuite/tr1/5_numerical_facilities/special_functions/
	18_laguerre/check_value.cc: Regen.
	* testsuite/tr1/5_numerical_facilities/special_functions/
	19_legendre/check_value.cc: Regen.
	* testsuite/tr1/5_numerical_facilities/special_functions/
	20_riemann_zeta/check_value_neg.cc: Regen.
	* testsuite/tr1/5_numerical_facilities/special_functions/
	21_sph_bessel/check_value.cc: Regen.
	* testsuite/tr1/5_numerical_facilities/special_functions/
	22_sph_legendre/check_value.cc: Regen.
	* testsuite/tr1/5_numerical_facilities/special_functions/
	23_sph_neumann/check_value.cc: Regen.
	* testsuite/ext/special_functions/conf_hyperg/check_value.cc: Regen.
	* testsuite/ext/special_functions/hyperg/check_value.cc: Regen.
	* testsuite/special_functions/01_assoc_laguerre/check_value.cc: Regen.
	* testsuite/special_functions/02_assoc_legendre/check_value.cc: Regen.
	* testsuite/special_functions/03_beta/check_value.cc: Regen.
	* testsuite/special_functions/04_comp_ellint_1/check_value.cc: Regen.
	* testsuite/special_functions/05_comp_ellint_2/check_value.cc: Regen.
	* testsuite/special_functions/07_cyl_bessel_i/check_value.cc: Regen.
	* testsuite/special_functions/08_cyl_bessel_j/check_value.cc: Regen.
	* testsuite/special_functions/09_cyl_bessel_k/check_value.cc: Regen.
 	* testsuite/special_functions/10_cyl_neumann/check_value.cc: Regen.
	* testsuite/special_functions/11_ellint_1/check_value.cc: Regen.
	* testsuite/special_functions/12_ellint_2/check_value.cc: Regen.
	* testsuite/special_functions/14_expint/check_value.cc: Regen.
	* testsuite/special_functions/15_hermite/check_value.cc: Regen.
	* testsuite/special_functions/16_laguerre/check_value.cc: Regen.
	* testsuite/special_functions/17_legendre/check_value.cc: Regen.
	* testsuite/special_functions/18_riemann_zeta/check_value.cc: Regen.
	* testsuite/special_functions/19_sph_bessel/check_value.cc: Regen.
	* testsuite/special_functions/20_sph_legendre/check_value.cc: Regen.
	* testsuite/special_functions/21_sph_neumann/check_value.cc: Regen.
	* testsuite/tr1/5_numerical_facilities/special_functions/
	06_comp_ellint_3/pr66689.cc: New.
	* testsuite/tr1/5_numerical_facilities/special_functions/
	14_ellint_3/pr66689.cc: New.
	* testsuite/special_functions/06_comp_ellint_3/pr66689.cc: New.
	* testsuite/special_functions/13_ellint_3/pr66689.cc: New.

From-SVN: r254924
2017-11-19 01:01:50 +00:00
Edward Smith-Rowland a7a389d6ee specfun.h: Expose airy_ai and airy_bi.
2017-11-18  Edward Smith-Rowland  <3dw4rd@verizon.net>

	* include/bits/specfun.h: Expose airy_ai and airy_bi.
	* include/tr1/modified_bessel_func.tcc: Treat NaN and inf arg, return.
	* testsuite/ext/special_functions/airy_ai/check_nan.cc: New.
	* testsuite/ext/special_functions/airy_ai/check_value.cc: New.
	* testsuite/ext/special_functions/airy_ai/compile.cc: New.
	* testsuite/ext/special_functions/airy_bi/check_nan.cc: New.
	* testsuite/ext/special_functions/airy_bi/check_value.cc: New.
	* testsuite/ext/special_functions/airy_bi/compile.cc: New.

From-SVN: r254917
2017-11-18 19:53:25 +00:00
Igor Tsimbalist 36101de964 Enable building libstdc++-v3 with Intel CET
libstdc++-v3/
	* acinclude.m4: Add cet.m4.
	* configure.ac: Set CET_FLAGS. Update EXTRA_CFLAGS,
	EXTRA_CXX_FLAGS.
	* libsupc++/Makefile.am: Use Add EXTRA_CFLAGS.
	* Makefile.in: Regenerate.
	* configure: Likewise.
	* doc/Makefile.in: Likewise.
	* include/Makefile.in: Likewise.
	* libsupc++/Makefile.in: Likewise.
	* po/Makefile.in: Likewise.
	* python/Makefile.in: Likewise.
	* src/Makefile.in: Likewise.
	* src/c++11/Makefile.in: Likewise.
	* src/c++98/Makefile.in: Likewise.
	* src/filesystem/Makefile.in: Likewise.
	* testsuite/Makefile.in: Likewise.

From-SVN: r254895
2017-11-17 22:28:10 +01:00
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 4e6c429837 Minor improvements to Filesystem tests
* testsuite/27_io/filesystem/iterators/directory_iterator.cc: Leave
	error_code unset.
	* testsuite/27_io/filesystem/iterators/recursive_directory_iterator.cc:
	Check for past-the-end before dereferencing.
	* testsuite/experimental/filesystem/iterators/
	recursive_directory_iterator.cc: Likewise.

From-SVN: r254781
2017-11-15 18:22:43 +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 d2e9196e5f Fix typo in std::wbuffer_convert
* include/bits/locale_conv.h (wbuffer_convert::_M_conv_get): Fix typo.
	* testsuite/22_locale/conversions/buffer/3.cc: New test.

From-SVN: r254735
2017-11-14 18:00:53 +00:00
Jonathan Wakely 34c71b8b3a Minor tweak to libstdc++ testsuite helper type
* testsuite/util/testsuite_tr1.h (ThrowMoveConsClass): Use noexcept.

From-SVN: r254644
2017-11-11 00:10:07 +00:00
François Dumont 187e8ee733 tr1.cc: Compile with -O0.
2017-11-06  François Dumont  <fdumont@gcc.gnu.org>

	* testsuite/libstdc++-prettyprinters/tr1.cc:  Compile with -O0.

From-SVN: r254477
2017-11-06 21:15:48 +00:00
Martin Liska 454f8b2b0c Fix -Wreturn-type fallout.
2017-11-06  Martin Liska  <mliska@suse.cz>

	* c-c++-common/cilk-plus/AN/pr57541-2.c (foo1): Return a value
	for functions with non-void return type, or change type to void,
	or add -Wno-return-type for test.
	(foo2): Likewise.
	* c-c++-common/cilk-plus/AN/pr57541.c (foo): Likewise.
	(foo1): Likewise.
	* c-c++-common/cilk-plus/CK/errors.c: Likewise.
	* c-c++-common/cilk-plus/CK/pr60197.c: Likewise.
	* c-c++-common/cilk-plus/CK/spawn_in_return.c: Likewise.
	* c-c++-common/fold-masked-cmp-1.c (test_pic): Likewise.
	(test_exe): Likewise.
	* c-c++-common/fold-masked-cmp-2.c (test_exe): Likewise.
	* g++.dg/cilk-plus/AN/builtin_fn_mutating_tplt.cc (my_func): Likewise.
	* g++.dg/cilk-plus/CK/pr68997.cc (fa2): Likewise.
	* g++.dg/eh/sighandle.C (dosegv): Likewise.
	* g++.dg/ext/vector14.C (foo): Likewise.
	(main): Likewise.
	* g++.dg/graphite/pr41305.C: Likewise.
	* g++.dg/graphite/pr42930.C: Likewise.
	* g++.dg/opt/pr46640.C (struct QBasicAtomicInt): Likewise.
	(makeDir): Likewise.
	* g++.dg/other/i386-8.C (foo): Likewise.
	* g++.dg/pr45788.C: Likewise.
	* g++.dg/pr64688.C (at_c): Likewise.
	* g++.dg/pr65032.C (G::DecodeVorbis): Likewise.
	* g++.dg/pr71633.C (c3::fn2): Likewise.
	* g++.dg/stackprotectexplicit2.C (A): Likewise.
	* g++.old-deja/g++.law/weak.C (main): Likewise.
2017-11-06  Martin Liska  <mliska@suse.cz>

	* testsuite/libgomp.c++/loop-2.C: Return a value
	for functions with non-void return type, or change type to void,
	or add -Wno-return-type for test.
	* testsuite/libgomp.c++/loop-4.C: Likewise.
	* testsuite/libgomp.c++/parallel-1.C: Likewise.
	* testsuite/libgomp.c++/shared-1.C: Likewise.
	* testsuite/libgomp.c++/single-1.C: Likewise.
	* testsuite/libgomp.c++/single-2.C: Likewise.
2017-11-06  Martin Liska  <mliska@suse.cz>

	* testsuite/27_io/basic_fstream/cons/char/path.cc (main):
	  Return a value for functions with non-void return type,
	  or change type to void, or add -Wno-return-type for test.
	* testsuite/27_io/basic_ifstream/cons/char/path.cc (main):
	Likewise.
	* testsuite/27_io/basic_ofstream/open/char/path.cc (main):
	Likewise.

From-SVN: r254451
2017-11-06 13:41:35 +00:00
Paolo Carlini 98910bc2b9 deduction.cc: Avoid -Wreturn-type warnings.
2017-11-06  Paolo Carlini  <paolo.carlini@oracle.com>

	* testsuite/20_util/optional/cons/deduction.cc: Avoid -Wreturn-type
	warnings.
	* testsuite/20_util/pair/cons/deduction.cc: Likewise.
	* testsuite/20_util/pair/traits.cc: Likewise.
	* testsuite/20_util/tuple/cons/deduction.cc: Likewise.
	* testsuite/20_util/variant/compile.cc: Likewise.
	* testsuite/23_containers/map/modifiers/try_emplace/1.cc: Likewise.
	* testsuite/23_containers/unordered_map/modifiers/try_emplace.cc:
	Likewise.

From-SVN: r254450
2017-11-06 12:55:35 +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 50e248f0c8 PR libstdc++/82777 fix path normalization for dot-dot
PR libstdc++/82777
	* src/filesystem/std-path.cc (path::lexically_normal): Remove dot-dot
	elements correctly.
	* testsuite/27_io/filesystem/path/generation/normal.cc: Add testcase.
	* testsuite/util/testsuite_fs.h (compare_paths): Improve exception
	text.

From-SVN: r254317
2017-11-01 17:09:14 +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 9a3effa411 Make filesystem::file_status default constructor non-explicit (LWG 2787)
* include/bits/fs_dir.h (file_status): Make default constructor
	non-explicit (LWG 2787).
	* testsuite/27_io/filesystem/file_status/1.cc: New test.
	* testsuite/experimental/filesystem/file_status/1.cc: New test.

From-SVN: r254159
2017-10-27 18:49:21 +01: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 0348dd008a Define std::filesystem::path::format enum (P0430R2)
* include/bits/fs_path.h (path::format): Define new enumeration type.
	(path(string_type&&), path<Source>(const Source&))
	(path<InputIterator>(InputIterator, InputIterator))
	(path<Source>(const Source&, const locale&))
	(path<InputIterator>(InputIterator, InputIterator, const locale&)):
	Add format parameter.
	* testsuite/27_io/filesystem/path/construct/format.cc: New test.

From-SVN: r254144
2017-10-27 13:01:49 +01:00
Jonathan Wakely d67be4437a Protect more algorithms from overloaded comma operators
* include/bits/stl_algo.h (__find_if_not_n, generate_n): Cast to void
	to ensure overloaded comma not used.
	* include/bits/stl_algobase.h (__fill_n_a, equal): Likewise.
	* include/bits/stl_uninitialized.h (__uninitialized_fill_n)
	(__uninitialized_fill_n_a, __uninitialized_default_n_1)
	(__uninitialized_default_n_a, __uninitialized_copy_n)
	(__uninitialized_copy_n_pair): Likewise
	* testsuite/20_util/specialized_algorithms/memory_management_tools/1.cc:
	Use test iterator wrappers with overloaded comma operator.
	* testsuite/25_algorithms/fill_n/1.cc: Likewise.
	* testsuite/25_algorithms/generate_n/1.cc: New test.
	* testsuite/25_algorithms/stable_partition/1.cc: New test.
	* testsuite/util/testsuite_iterators.h (operator,): Add deleted
	non-member comma operator with iterator wrappers as right operand.

From-SVN: r254128
2017-10-27 00:50:40 +01:00
Ville Voutilainen 957f5feacf Deduction guides for associative containers, debug mode deduction guide fixes.
* include/bits/stl_iterator.h (__iter_key_t)
(__iter_val_t, __iter_to_alloc_t): New.
* include/bits/stl_map.h: Add deduction guides.
* include/bits/stl_multimap.h: Likewise.
* include/bits/stl_multiset.h: Likewise.
* include/bits/stl_set.h: Likewise.
* include/bits/unordered_map.h: Likewise.
* include/bits/unordered_set.h: Likewise.
* include/debug/deque: Likewise.
* include/debug/forward_list: Likewise.
* include/debug/list: Likewise.
* include/debug/map.h: Likewise.
* include/debug/multimap.h: Likewise.
* include/debug/multiset.h: Likewise.
* include/debug/set.h: Likewise.
* include/debug/unordered_map: Likewise.
* include/debug/unordered_set: Likewise.
* include/debug/vector: Likewise.
* testsuite/23_containers/map/cons/deduction.cc: New.
* testsuite/23_containers/multimap/cons/deduction.cc: Likewise.
* testsuite/23_containers/multiset/cons/deduction.cc: Likewise.
* testsuite/23_containers/set/cons/deduction.cc: Likewise.
* testsuite/23_containers/unordered_map/cons/deduction.cc: Likewise.
* testsuite/23_containers/unordered_multimap/cons/deduction.cc:
Likewise.
* testsuite/23_containers/unordered_multiset/cons/deduction.cc:
Likewise.
* testsuite/23_containers/unordered_set/cons/deduction.cc: Likewise.

From-SVN: r254113
2017-10-26 19:42:31 +03:00
Jonathan Wakely eeb517d3e7 Fix filesystem::path::lexically_normal algorithm
* src/filesystem/std-path.cc (path::lexically_normal): Add missing
	step to algorithm, for removing dot-dot elements after root-directory.
	* testsuite/27_io/filesystem/operations/canonical.cc: Use
	compare_paths for more exhaustive checks.
	* testsuite/27_io/filesystem/operations/proximate.cc: Likewise.
	* testsuite/27_io/filesystem/path/append/path.cc: Likewise.
	* testsuite/27_io/filesystem/path/concat/path.cc: Likewise.
	* testsuite/27_io/filesystem/path/concat/strings.cc: Fix comment.
	* testsuite/27_io/filesystem/path/construct/locale.cc: Likewise.
	* testsuite/27_io/filesystem/path/decompose/root_directory.cc:
	Likewise.
	* testsuite/27_io/filesystem/path/generation/normal.cc: Use
	compare_paths for more exhaustive checks. Add extra testcases.
	* testsuite/27_io/filesystem/path/generation/proximate.cc: Use
	compare_paths for more exhaustive checks.
	* testsuite/27_io/filesystem/path/generation/relative.cc: Likewise.
	* testsuite/27_io/filesystem/path/generic/generic_string.cc: Remove
	unused header.
	* testsuite/27_io/filesystem/path/modifiers/make_preferred.cc: Fix
	comment.
	* testsuite/27_io/filesystem/path/modifiers/remove_filename.cc: Use
	compare_paths for more exhaustive checks.
	* testsuite/27_io/filesystem/path/modifiers/replace_extension.cc:
	Likewise.
	* testsuite/27_io/filesystem/path/modifiers/replace_filename.cc:
	Likewise.
	* testsuite/util/testsuite_fs.h (compare_paths): Also compare native
	strings.

From-SVN: r254075
2017-10-25 13:42:53 +01:00
Jonathan Wakely e921c7e5a6 PR libstdc++/82706 fix test for case where operations succeed
PR libstdc++/82706
	* testsuite/27_io/filesystem/operations/permissions.cc: Fix test.

From-SVN: r254067
2017-10-25 01:27:10 +01:00
François Dumont 8468bfe8cb libstdc++.exp (check_v3_target_normal_mode): Add c++config.h include.
2017-10-24  François Dumont  <fdumont@gcc.gnu.org>

	* testsuite/lib/libstdc++.exp (check_v3_target_normal_mode): Add
	c++config.h include.
	(check_v3_target_normal_namespace): New.
	* testsuite/lib/dg-options.exp (dg-require-normal-namespace): New.
	* testsuite/18_support/headers/limits/synopsis.cc: Add latter.
	* testsuite/20_util/from_chars/requirements.cc: Likewise.
	* testsuite/20_util/headers/functional/synopsis.cc: Likewise.
	* testsuite/20_util/headers/memory/synopsis.cc: Likewise.
	* testsuite/20_util/headers/utility/synopsis.cc: Likewise.
	* testsuite/20_util/to_chars/requirements.cc: Likewise.
	* testsuite/21_strings/headers/string/synopsis.cc: Likewise.
	* testsuite/22_locale/headers/locale/synopsis.cc: Likewise.
	* testsuite/23_containers/headers/bitset/synopsis.cc: Likewise.
	* testsuite/23_containers/headers/deque/synopsis.cc: Likewise.
	* testsuite/23_containers/headers/forward_list/synopsis.cc: Likewise.
	* testsuite/23_containers/headers/list/synopsis.cc: Likewise.
	* testsuite/23_containers/headers/map/synopsis.cc: Likewise.
	* testsuite/23_containers/headers/queue/synopsis.cc: Likewise.
	* testsuite/23_containers/headers/set/synopsis.cc: Likewise.
	* testsuite/23_containers/headers/stack/synopsis.cc: Likewise.
	* testsuite/23_containers/headers/vector/synopsis.cc: Likewise.
	* testsuite/23_containers/map/modifiers/erase/abi_tag.cc: Likewise.
	* testsuite/23_containers/multimap/modifiers/erase/abi_tag.cc: Likewise.
	* testsuite/23_containers/multiset/modifiers/erase/abi_tag.cc: Likewise.
	* testsuite/23_containers/set/modifiers/erase/abi_tag.cc: Likewise.
	* testsuite/24_iterators/headers/iterator/synopsis.cc: Likewise.
	* testsuite/24_iterators/headers/iterator/synopsis_c++11.cc: Likewise.
	* testsuite/24_iterators/headers/iterator/synopsis_c++14.cc: Likewise.
	* testsuite/24_iterators/headers/iterator/synopsis_c++17.cc: Likewise.
	* testsuite/26_numerics/complex/abi_tag.cc: Likewise.
	* testsuite/26_numerics/headers/complex/synopsis.cc: Likewise.
	* testsuite/26_numerics/headers/valarray/synopsis.cc: Likewise.
	* testsuite/27_io/headers/fstream/synopsis.cc: Likewise.
	* testsuite/27_io/headers/ios/synopsis.cc: Likewise.
	* testsuite/27_io/headers/istream/synopsis.cc: Likewise.
	* testsuite/27_io/headers/ostream/synopsis.cc: Likewise.
	* testsuite/27_io/headers/sstream/synopsis.cc: Likewise.
	* testsuite/27_io/headers/streambuf/synopsis.cc: Likewise.

From-SVN: r254060
2017-10-24 20:20:12 +00: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 908d1d3aea PR libstdc++/82644 document IS 29124 support
Also fix declarations of special functions in C++17, to import them into
the global namespace in <math.h>, and to prevent defining the
non-standard hypergeometric functions in strict mode.

	PR libstdc++/82644
	* doc/xml/manual/intro.xml: Include new section.
	* doc/xml/manual/status_cxxis29124.xml: New section on IS 29124
	status.
	* include/bits/specfun.h [__STRICT_ANSI__] (hyperg, hypergf, hypergl)
	(conf_hyperg, conf_hypergf, conf_hypergl): Don't declare.
	* include/c_compatibility/math.h: Import special functions into
	global namespace for C++17.
	* testsuite/26_numerics/headers/cmath/82644.cc: New test.
	* testsuite/26_numerics/headers/cmath/functions_global_c++17.cc: New
	test.

From-SVN: r254004
2017-10-23 12:10:28 +01:00
Jonathan Wakely dfdf2839b5 Fix invalid path::iterator test
* testsuite/experimental/filesystem/path/itr/traversal.cc: Do not
	increment past-the-end iterators.

From-SVN: r253967
2017-10-21 02:16:43 +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 253e8d2150 Define __cpp_lib_byte feature-test macro
* include/c_global/cstddef: Define __cpp_lib_byte feature-test macro.
	* testsuite/18_support/byte/requirements.cc: Check macro.

From-SVN: r253952
2017-10-20 19:02:19 +01:00
Jonathan Wakely db62ad7c66 Improve tests for error reporting in Filesystem TS
* testsuite/experimental/filesystem/iterators/
	recursive_directory_iterator.cc: Ensure that error_code arguments are
	cleared when required.
	* testsuite/experimental/filesystem/operations/create_directory.cc:
	Remove redundant check.
	* testsuite/experimental/filesystem/operations/temp_directory_path.cc:
	Ensure that error_code argument is cleared when required.

From-SVN: r253897
2017-10-19 14:57:10 +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 af23b26ab0 Use __LONG_LONG_MAX__ instead of LONG_LONG_MAX in test
* testsuite/decimal/conversion-to-integral.cc: Use predefined macro
	instead of non-standard glibc one.

From-SVN: r253894
2017-10-19 14:56:55 +01:00
François Dumont 1be043a140 re PR libstdc++/82558 (V8 JavaScript engine segfaults since r249235)
2017-10-16  François Dumont  <fdumont@gcc.gnu.org>

	PR libstdc++/82558
	* include/bits/stl_bvector.h (fill): Add iterator offset check.
	* testsuite/23_containers/vector/bool/82558.cc: New.

From-SVN: r253776
2017-10-16 05:44:03 +00:00
Jonathan Wakely 3b0dd4fea2 PR libstdc++/82522 overload map insert functions for rvalues (LWG 2354)
PR libstdc++/82522
	* doc/xml/manual/intro.xml: Document LWG 2354 changes.
	* include/bits/stl_map.h (map::insert(value_type&&))
	(map::insert(const_iterator, value_type&&)): Add overload for rvalues.
	* include/bits/stl_multimap.h (multimap::insert(value_type&&))
	(multimap::insert(const_iterator, value_type&&)): Likewise.
	* include/bits/unordered_map.h (unordered_map::insert(value_type&&))
	(unordered_map::insert(const_iterator, value_type&&))
	(unordered_multimap::insert(value_type&&))
	(unordered_multimap::insert(const_iterator, value_type&&)): Likewise.
	* testsuite/23_containers/map/modifiers/insert/dr2354.cc: New test.
	* testsuite/23_containers/multimap/modifiers/insert/dr2354.cc: New
	test.
	* testsuite/23_containers/unordered_map/insert/dr2354.cc: New test.
	* testsuite/23_containers/unordered_multimap/insert/dr2354.cc: New
	test.

From-SVN: r253725
2017-10-13 13:39:32 +01:00
Jonathan Wakely 5d2b807526 PR libstdc++/82417 do not include C99 <complex.h> in strict modes
As an extension the C++ version of <complex.h> includes the C version,
but that defines macros with non-reserved names that should not be
defined in ISO C++. Only include the C header for non-strict modes, or
for pre-C++11 (because C++98 doesn't mention <complex.h> at all).

	PR libstdc++/59087
	PR libstdc++/82417
	* include/c_compatibility/complex.h [!C++98 && __STRICT_ANSI__]: Do
	not include C library's <complex.h>.
	* testsuite/26_numerics/complex/c99.cc: Depend on __STRICT_ANSI__.
	* testsuite/26_numerics/headers/complex.h/std_c++11.h: New test.
	* testsuite/26_numerics/headers/complex.h/std_gnu++11.h: New test.
	* testsuite/26_numerics/headers/complex.h/std_c++98.h: New test.

From-SVN: r253581
2017-10-10 12:25:45 +01:00
Jonathan Wakely e58683fb9f Fix new testsuite failure on newlib targets
* testsuite/20_util/to_chars/1.cc: Add dg-require-string-conversions.

From-SVN: r253463
2017-10-05 21:26:08 +01:00
Petr Ovtchenkov 4e91452412 2017-10-04 Petr Ovtchenkov <ptr@void-ptr.info>
François Dumont  <fdumont@gcc.gnu.org>

	* include/bits/streambuf_iterator.h
	(istreambuf_iterator<>::operator*()): Do not capture iterator state
	in Debug assertion.
	(istreambuf_iterator<>::operator++()): Likewise and remove _M_sbuf check.
	(istreambuf_iterator<>::operator++(int)): Likewise.
	(istreambuf_iterator<>::_M_get()): Remove _M_c assignment.
	(istreambuf_iterator<>::_S_is_eof()): New.
	(istreambuf_iterator<>::_M_at_eof()): Adapt, use latter.
	(find(istreambuf_iterator<>, istreambuf_iterator<>, _CharT)):
	Return an iterator with _M_c set to eof to capture streambuf state
	on evaluation.
	(testsuite/24_iterators/istreambuf_iterator/2.cc): Add checks.

Co-Authored-By: François Dumont <fdumont@gcc.gnu.org>

From-SVN: r253417
2017-10-04 16:15:18 +00: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
François Dumont c320262396 22131.cc: Make test less istreambuf_iterator implementation dependent.
2017-09-27  François Dumont  <fdumont@gcc.gnu.org>

	* testsuite/22_locale/money_get/get/char/22131.cc: Make test less
	istreambuf_iterator implementation dependent.
	* testsuite/22_locale/money_get/get/wchar_t/22131.cc: Likewise.

From-SVN: r253237
2017-09-27 20:16:43 +00:00
Jonathan Wakely f3f08c3f03 Fix tests for std::clamp
* testsuite/25_algorithms/clamp/1.cc: Fix order of arguments and
	expected results when using predicate defining reverse order.
	* testsuite/25_algorithms/clamp/constexpr.cc: Likewise.

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

From-SVN: r253024
2017-09-20 18:59:50 +01:00
Jonathan Wakely e18f68c715 Fix failing C++17 test
* testsuite/24_iterators/range_access_cpp17.cc: Fix order of dg-do
	and dg-options directives. Fix invalid test.

From-SVN: r253019
2017-09-20 17:34:53 +01:00
Jonathan Wakely 95ed529d34 PR libstdc++/81469 deprecate std::uncaught_exception for C++17
PR libstdc++/81469
	* libsupc++/exception (uncaught_exception): Deprecate for C++17.
	* testsuite/18_support/exception_ptr/62258.cc: Add -Wno-deprecated.
	* testsuite/18_support/uncaught_exception/14026.cc: Likewise.

From-SVN: r253018
2017-09-20 17:34:49 +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 23b49089a4 PR libstdc++/71500 restore C++11 compatibility in <regex>
PR libstdc++/71500
	* include/bits/regex_executor.tcc
	(_Backref_matcher<BidIt, regex_traits<C>>::_M_apply): Use
	std::__equal4 instead of C++14 4-iterator overloads of std::equal.
	* include/bits/stl_algobase.h (__equal4): New functions implementing
	4-iterator overloads of std::equal for use in C++11.
	(equal(It1, It1, It2, It2), equal(It1, It1, It2, It2, BinaryPred)):
	Move function bodies to new __equal4 functions.
	* testsuite/28_regex/simple_c++11.cc: New.

From-SVN: r252981
2017-09-19 18:06:12 +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 e1227692dd PR libstdc++/81468 fix test for duration conversions
PR libstdc++/81468
	* testsuite/20_util/duration/cons/dr1177.cc: Fix incorrect test and
	improve static assertion messages.

From-SVN: r252950
2017-09-18 21:00:32 +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
Jakub Jelinek 7b9361409d invoke.texi: Document -std=c++17 and -std=gnu++17 and document c++1z and gnu++1z as deprecated.
* doc/invoke.texi: Document -std=c++17 and -std=gnu++17 and document
	c++1z and gnu++1z as deprecated.  Change other references to
	-std=c++1z to -std=c++17 and -std=gnu++1z to -std=gnu++17.
	Change -Wc++1z-compat to -Wc++17-compat.
	* doc/cpp.texi: Document -std=c++17 defines __cplusplus 201703L.
	* dwarf2out.c (highest_c_language): Handle C++17.
	(gen_compile_unit_die): Likewise.
c-family/
	* c.opt (Wc++1z-compat): Change from option to undocumented alias.
	(Wc++17-compat): Change from undocumented alias to option.
	(Wnoexcept-type): Enable by Wc++17-compat instead of Wc++1z-compat,
	change C++1z to C++17 in description.
	(std=c++1z, std=gnu++1z): Change from option to undocumented
	deprecated alias.
	(std=c++17, std=gnu++17): Change from undocumented alias to option.
	Adjust description.
	* c-common.h (enum cxx_dialect): Rename cxx1z to cxx17.
	* c-opts.c (set_std_cxx1z): Rename to ...
	(set_std_cxx17): ... this.
	(c_common_handle_option): Rename OPT_std_c__1z to OPT_std_c__17
	and OPT_std_gnu__1z to OPT_std_gnu__17.  Adjust set_std_cxx1z
	caller.  
	(c_common_post_options): Use cxx17 instead of cxx1z.  Adjust
	comments.
cp/
	* decl.c (redeclaration_error_message): Use cxx17 instead of cxx1z,
	adjust diagnostics refering to C++1z or -std=gnu++1z or -std=c++1z
	to C++17 or -std=gnu++17 or -std=c++17.  Adjust comments.
	(cxx_init_decl_processing, next_initializable_field,
	is_direct_enum_init, check_initializer, cp_finish_decl,
	mark_inline_variable, grokdeclarator, grokparms, xref_basetypes,
	finish_function): Likewise.
	* cp-tree.h (DECL_INLINE_VAR_P): Likewise.
	* pt.c (mark_template_parm, convert_nontype_argument,
	instantiate_class_template_1, type_unification_real, unify,
	get_partial_spec_bindings, dependent_type_p_r): Likewise.
	* typeck.c (cp_build_unary_op): Likewise.
	* constexpr.c (var_in_maybe_constexpr_fn): Likewise.
	* call.c (build_user_type_conversion_1, build_over_call,
	build_special_member_call): Likewise.
	* lambda.c (begin_lambda_type): Likewise.
	* typeck2.c (process_init_constructor_record): Likewise.
	* class.c (build_base_field, finalize_literal_type_property,
	explain_non_literal_class): Likewise.
	* parser.c (cp_parser_diagnose_invalid_type_name,
	cp_parser_primary_expression, cp_parser_lambda_introducer,
	cp_parser_lambda_declarator_opt, cp_parser_selection_statement,
	cp_convert_range_for, cp_parser_perform_range_for_lookup,
	cp_parser_decomposition_declaration, cp_parser_linkage_specification,
	cp_parser_static_assert, cp_parser_simple_type_specifier,
	cp_parser_namespace_definition, cp_parser_using_declaration,
	cp_parser_init_declarator, cp_parser_type_parameter_key,
	cp_parser_exception_specification_opt, cp_parser_std_attribute_spec,
	cp_parser_constructor_declarator_p): Likewise.
	* mangle.c (struct globals): Rename need_cxx1z_warning to
	need_cxx17_warning.
	(write_exception_spec, start_mangling, mangle_decl): Likewise.
	* Make-lang.in (check-c++1z): Rename to check-c++17, depend on
	it.
	(check-c++17): New goal.  Use 17 instead of 1z.
	(check-c++-all): Use 17 instead of 1z.
testsuite/
	* lib/g++-dg.exp (g++-dg-runtest): Use 17 instead of 1z.
	* lib/target-supports.exp (check_effective_target_c++14): Use
	check_effective_target_c++17 instead of check_effective_target_c++1z.
	(check_effective_target_c++14_down): Likewise.
	(check_effective_target_c++1z_only): Rename to ...
	(check_effective_target_c++17_only): ... this.
	(check_effective_target_c++1z): Rename to ...
	(check_effective_target_c++17): ... this.
	* g++.dg/debug/dwarf2/inline-var-1.C: Use -std=c++17 or -std=gnu++17
	instead of -std=c++1z or -std=gnu++1z.  Use c++17 instead of c++1z
	and c++17_only instead of c++1z_only.  Adjust expected diagnostics
	and comments refering to 1z to 17.
	* g++.dg/debug/dwarf2/inline-var-2.C: Likewise.
	* g++.dg/template/partial5.C: Likewise.
	* g++.dg/template/nontype8.C: Likewise.
	* g++.dg/cpp1z/noexcept-type5.C: Likewise.
	* g++.dg/cpp1z/nontype3a.C: Likewise.
	* g++.dg/cpp1z/constexpr-lambda4.C: Likewise.
	* g++.dg/cpp1z/noexcept-type16.C: Likewise.
	* g++.dg/cpp1z/class-deduction32.C: Likewise.
	* g++.dg/cpp1z/pr78771.C: Likewise.
	* g++.dg/cpp1z/elide1.C: Likewise.
	* g++.dg/cpp1z/fold3.C: Likewise.
	* g++.dg/cpp1z/class-deduction2.C: Likewise.
	* g++.dg/cpp1z/noexcept-type12.C: Likewise.
	* g++.dg/cpp1z/inline-var2.C: Likewise.
	* g++.dg/cpp1z/eval-order2.C: Likewise.
	* g++.dg/cpp1z/decomp21.C: Likewise.
	* g++.dg/cpp1z/constexpr-lambda11.C: Likewise.
	* g++.dg/cpp1z/constexpr-lambda9.C: Likewise.
	* g++.dg/cpp1z/utf8-neg.C: Likewise.
	* g++.dg/cpp1z/class-deduction41.C: Likewise.
	* g++.dg/cpp1z/class-deduction23.C: Likewise.
	* g++.dg/cpp1z/nodiscard3.C: Likewise.
	* g++.dg/cpp1z/static_assert-nomsg.C: Likewise.
	* g++.dg/cpp1z/noexcept-type9.C: Likewise.
	* g++.dg/cpp1z/class-deduction21.C: Likewise.
	* g++.dg/cpp1z/range-for1.C: Likewise.
	* g++.dg/cpp1z/init-statement4.C: Likewise.
	* g++.dg/cpp1z/udlit-utf8char.C: Likewise.
	* g++.dg/cpp1z/decomp30.C: Likewise.
	* g++.dg/cpp1z/class-deduction39.C: Likewise.
	* g++.dg/cpp1z/register2.C: Likewise.
	* g++.dg/cpp1z/decomp9.C: Likewise.
	* g++.dg/cpp1z/regress1.C: Likewise.
	* g++.dg/cpp1z/direct-enum-init1.C: Likewise.
	* g++.dg/cpp1z/class-deduction30.C: Likewise.
	* g++.dg/cpp1z/abbrev2.C: Likewise.
	* g++.dg/cpp1z/nontype-auto6.C: Likewise.
	* g++.dg/cpp1z/regress2.C: Likewise.
	* g++.dg/cpp1z/decomp16.C: Likewise.
	* g++.dg/cpp1z/bool-increment1.C: Likewise.
	* g++.dg/cpp1z/aligned-new1.C: Likewise.
	* g++.dg/cpp1z/decomp3.C: Likewise.
	* g++.dg/cpp1z/register1.C: Likewise.
	* g++.dg/cpp1z/namespace-attribs.C: Likewise.
	* g++.dg/cpp1z/class-deduction1.C: Likewise.
	* g++.dg/cpp1z/decomp10.C: Likewise.
	* g++.dg/cpp1z/constexpr-if11.C: Likewise.
	* g++.dg/cpp1z/constexpr-lambda10.C: Likewise.
	* g++.dg/cpp1z/decomp27.C: Likewise.
	* g++.dg/cpp1z/noexcept-type2.C: Likewise.
	* g++.dg/cpp1z/constexpr-lambda6.C: Likewise.
	* g++.dg/cpp1z/class-deduction9.C: Likewise.
	* g++.dg/cpp1z/attributes-enum-1.C: Likewise.
	* g++.dg/cpp1z/decomp11.C: Likewise.
	* g++.dg/cpp1z/aligned-new3.C: Likewise.
	* g++.dg/cpp1z/utf8-2.C: Likewise.
	* g++.dg/cpp1z/lambda-this3.C: Likewise.
	* g++.dg/cpp1z/decomp-constexpr1.C: Likewise.
	* g++.dg/cpp1z/byte1.C: Likewise.
	* g++.dg/cpp1z/nontype-auto9.C: Likewise.
	* g++.dg/cpp1z/aggr-base4.C: Likewise.
	* g++.dg/cpp1z/constexpr-lambda1.C: Likewise.
	* g++.dg/cpp1z/nontype-auto3.C: Likewise.
	* g++.dg/cpp1z/utf8-2a.C: Likewise.
	* g++.dg/cpp1z/constexpr-lambda7.C: Likewise.
	* g++.dg/cpp1z/aggr-base6.C: Likewise.
	* g++.dg/cpp1z/cplusplus.C: Likewise.
	* g++.dg/cpp1z/class-deduction20.C: Likewise.
	* g++.dg/cpp1z/aggr-base2.C: Likewise.
	* g++.dg/cpp1z/class-deduction6.C: Likewise.
	* g++.dg/cpp1z/noexcept-type3.C: Likewise.
	* g++.dg/cpp1z/class-deduction31.C: Likewise.
	* g++.dg/cpp1z/class-deduction25.C: Likewise.
	* g++.dg/cpp1z/class-deduction18.C: Likewise.
	* g++.dg/cpp1z/fold9.C: Likewise.
	* g++.dg/cpp1z/noexcept-type8.C: Likewise.
	* g++.dg/cpp1z/abbrev1.C: Likewise.
	* g++.dg/cpp1z/constexpr-if10.C: Likewise.
	* g++.dg/cpp1z/utf8.C: Likewise.
	* g++.dg/cpp1z/noexcept-type7.C: Likewise.
	* g++.dg/cpp1z/aggr-base3.C: Likewise.
	* g++.dg/cpp1z/constexpr-lambda8.C: Likewise.
	* g++.dg/cpp1z/init-statement2.C: Likewise.
	* g++.dg/cpp1z/nontype-auto4.C: Likewise.
	* g++.dg/cpp1z/constexpr-if12.C: Likewise.
	* g++.dg/cpp1z/class-deduction40.C: Likewise.
	* g++.dg/cpp1z/nontype3.C: Likewise.
	* g++.dg/cpp1z/class-deduction14.C: Likewise.
	* g++.dg/cpp1z/fold7.C: Likewise.
	* g++.dg/cpp1z/nontype2.C: Likewise.
	* g++.dg/cpp1z/class-deduction15.C: Likewise.
	* g++.dg/cpp1z/nested-namespace-def1.C: Likewise.
	* g++.dg/cpp1z/class-deduction13.C: Likewise.
	* g++.dg/cpp1z/aligned-new7.C: Likewise.
	* g++.dg/cpp1z/noexcept-type1.C: Likewise.
	* g++.dg/cpp1z/nontype1.C: Likewise.
	* g++.dg/cpp1z/init-statement5.C: Likewise.
	* g++.dg/cpp1z/nontype-auto2.C: Likewise.
	* g++.dg/cpp1z/decomp17.C: Likewise.
	* g++.dg/cpp1z/fold4.C: Likewise.
	* g++.dg/cpp1z/constexpr-lambda2.C: Likewise.
	* g++.dg/cpp1z/fold7a.C: Likewise.
	* g++.dg/cpp1z/nontype-auto5.C: Likewise.
	* g++.dg/cpp1z/init-statement7.C: Likewise.
	* g++.dg/cpp1z/aggr-base5.C: Likewise.
	* g++.dg/cpp1z/constexpr-lambda5.C: Likewise.
	* g++.dg/cpp1z/pr79143.C: Likewise.
	* g++.dg/cpp1z/class-deduction38.C: Likewise.
	* g++.dg/cpp1z/nontype-auto8.C: Likewise.
	* g++.dg/cpp1z/class-deduction12.C: Likewise.
	* g++.dg/cpp1z/decomp20.C: Likewise.
	* g++.dg/cpp1z/class-deduction22.C: Likewise.
	* g++.dg/cpp1z/class-deduction29.C: Likewise.
	* g++.dg/cpp1z/class-deduction8.C: Likewise.
	* g++.dg/cpp1z/class-deduction43.C: Likewise.
	* g++.dg/cpp1z/feat-cxx1z.C: Likewise.
	* g++.dg/cpp1z/fold8.C: Likewise.
	* g++.dg/cpp1z/init-statement3.C: Likewise.
	* g++.dg/cpp1z/nontype-auto10.C: Likewise.
	* g++.dg/cpp1z/class-deduction36.C: Likewise.
	* g++.dg/cpp1z/noexcept-type17.C: Likewise.
	* g++.dg/cpp1z/fallthrough1.C: Likewise.
	* g++.dg/cpp1z/fold1.C: Likewise.
	* g++.dg/cpp1z/class-deduction26.C: Likewise.
	* g++.dg/cpp1z/fold-ice1.C: Likewise.
	* g++.dg/cpp1z/fold5.C: Likewise.
	* g++.dg/cpp1z/class-deduction34.C: Likewise.
	* g++.dg/cpp1z/noexcept-type6.C: Likewise.
	* g++.dg/cpp1z/class-deduction7.C: Likewise.
	* g++.dg/cpp1z/class-deduction16.C: Likewise.
	* g++.dg/cpp1z/class-deduction10.C: Likewise.
	* g++.dg/cpp1z/eval-order3.C: Likewise.
	* g++.dg/cpp1z/constexpr-lambda13.C: Likewise.
	* g++.dg/cpp1z/aggr-base2a.C: Likewise.
	* g++.dg/cpp1z/nontype-auto1.C: Likewise.
	* g++.dg/cpp1z/constexpr-lambda3.C: Likewise.
	* g++.dg/cpp1z/nontype-auto7.C: Likewise.
	* g++.dg/cpp1z/decomp15.C: Likewise.
	* g++.dg/cpp1z/noexcept-type4.C: Likewise.
	* g++.dg/cpp1z/fold-mangle.C: Likewise.
	* g++.dg/cpp1z/class-deduction35.C: Likewise.
	* g++.dg/cpp1z/decomp4.C: Likewise.
	* g++.dg/cpp1z/class-deduction42.C: Likewise.
	* g++.dg/cpp1z/init-statement8.C: Likewise.
	* g++.dg/cpp1z/inline-var1a.C: Likewise.
	* g++.dg/cpp1z/init-statement6.C: Likewise.
	* g++.dg/cpp1z/class-deduction17.C: Likewise.
	* g++.dg/cpp1z/class-deduction28.C: Likewise.
	* g++.dg/cpp1z/class-deduction27.C: Likewise.
	* g++.dg/cpp1z/decomp-bitfield1.C: Likewise.
	* g++.dg/cpp1z/attributes-enum-1a.C: Likewise.
	* g++.dg/cpp1z/class-deduction11.C: Likewise.
	* g++.dg/cpp1z/constexpr-lambda12.C: Likewise.
	* g++.dg/cpp1z/init-statement9.C: Likewise.
	* g++.dg/cpp1z/class-deduction19.C: Likewise.
	* g++.dg/cpp1z/class-deduction5.C: Likewise.
	* g++.dg/cpp1z/fold2.C: Likewise.
	* g++.dg/cpp1z/class-deduction33.C: Likewise.
	* g++.dg/cpp1z/class-deduction24.C: Likewise.
	* g++.dg/cpp1z/aggr-base1.C: Likewise.
	* g++.dg/cpp1z/fold6.C: Likewise.
	* g++.dg/cpp1z/decomp12.C: Likewise.
	* g++.dg/cpp1z/class-deduction4.C: Likewise.
	* g++.dg/cpp1z/inline-var1.C: Likewise.
	* g++.dg/cpp1z/aligned-new2.C: Likewise.
	* g++.dg/cpp1z/class-deduction3.C: Likewise.
	* g++.dg/other/error3.C: Likewise.
	* g++.dg/init/new25.C: Likewise.
	* g++.dg/init/new13.C: Likewise.
	* g++.dg/tls/diag-2.C: Likewise.
	* g++.dg/tls/diag-4.C: Likewise.
	* g++.dg/opt/noreturn-1.C: Likewise.
	* g++.dg/eh/async-unwind2.C: Likewise.
	* g++.dg/eh/spec9.C: Likewise.
	* g++.dg/eh/spec7.C: Likewise.
	* g++.dg/eh/template1.C: Likewise.
	* g++.dg/eh/cond4.C: Likewise.
	* g++.dg/eh/pr41819.C: Likewise.
	* g++.dg/eh/delete1.C: Likewise.
	* g++.dg/eh/spec3.C: Likewise.
	* g++.dg/eh/forced4.C: Likewise.
	* g++.dg/eh/spec2.C: Likewise.
	* g++.dg/eh/shadow1.C: Likewise.
	* g++.dg/eh/pr38662.C: Likewise.
	* g++.dg/eh/ehopt1.C: Likewise.
	* g++.dg/eh/spec8.C: Likewise.
	* g++.dg/eh/init-temp2.C: Likewise.
	* g++.dg/rtti/crash3.C: Likewise.
	* g++.dg/warn/Wreturn-type-3.C: Likewise.
	* g++.dg/warn/register-parm-1.C: Likewise.
	* g++.dg/warn/register-var-2.C: Likewise.
	* g++.dg/gcov/gcov-7.C: Likewise.
	* g++.dg/tree-ssa/pr45605.C: Likewise.
	* g++.dg/cpp/pr23827_cxx98_neg.C: Likewise.
	* g++.dg/lookup/exception1.C: Likewise.
	* g++.dg/ubsan/pr79589.C: Likewise.
	* g++.dg/tm/pr47340.C: Likewise.
	* g++.dg/tm/pr46567.C: Likewise.
	* g++.dg/expr/bitfield5.C: Likewise.
	* g++.dg/expr/bool1.C: Likewise.
	* g++.dg/expr/lval3.C: Likewise.
	* g++.dg/expr/lval4.C: Likewise.
	* g++.dg/expr/bitfield4.C: Likewise.
	* g++.dg/expr/bitfield6.C: Likewise.
	* g++.dg/expr/bool3.C: Likewise.
	* g++.dg/ext/has_nothrow_constructor.C: Likewise.
	* g++.dg/ext/has_nothrow_copy-7.C: Likewise.
	* g++.dg/ext/has_nothrow_copy-1.C: Likewise.
	* g++.dg/ext/has_nothrow_copy-2.C: Likewise.
	* g++.dg/ext/has_nothrow_copy-4.C: Likewise.
	* g++.dg/ext/has_nothrow_copy-5.C: Likewise.
	* g++.dg/ext/has_nothrow_copy-6.C: Likewise.
	* g++.dg/ext/has_nothrow_assign.C: Likewise.
	* g++.dg/parse/register1.C: Likewise.
	* g++.dg/parse/error15.C: Likewise.
	* g++.dg/parse/linkage2.C: Likewise.
	* g++.dg/concepts/intro2.C: Likewise.
	* g++.dg/concepts/class.C: Likewise.
	* g++.dg/concepts/traits1.C: Likewise.
	* g++.dg/concepts/req5.C: Likewise.
	* g++.dg/concepts/var-concept5.C: Likewise.
	* g++.dg/concepts/fn-concept2.C: Likewise.
	* g++.dg/concepts/traits2.C: Likewise.
	* g++.dg/concepts/placeholder2.C: Likewise.
	* g++.dg/concepts/class6.C: Likewise.
	* g++.dg/concepts/memtmpl1.C: Likewise.
	* g++.dg/concepts/friend2.C: Likewise.
	* g++.dg/concepts/template-parm3.C: Likewise.
	* g++.dg/concepts/template-parm10.C: Likewise.
	* g++.dg/concepts/explicit-spec1.C: Likewise.
	* g++.dg/concepts/explicit-spec3.C: Likewise.
	* g++.dg/concepts/var-templ2.C: Likewise.
	* g++.dg/concepts/intro5.C: Likewise.
	* g++.dg/concepts/deduction-constraint1.C: Likewise.
	* g++.dg/concepts/iconv1.C: Likewise.
	* g++.dg/concepts/constrained-parm.C: Likewise.
	* g++.dg/concepts/template-template-parm1.C: Likewise.
	* g++.dg/concepts/var-concept3.C: Likewise.
	* g++.dg/concepts/class3.C: Likewise.
	* g++.dg/concepts/memfun2.C: Likewise.
	* g++.dg/concepts/req1.C: Likewise.
	* g++.dg/concepts/disjunction1.C: Likewise.
	* g++.dg/concepts/req17.C: Likewise.
	* g++.dg/concepts/pr65848.C: Likewise.
	* g++.dg/concepts/placeholder4.C: Likewise.
	* g++.dg/concepts/decl-diagnose.C: Likewise.
	* g++.dg/concepts/intro7.C: Likewise.
	* g++.dg/concepts/pr68683.C: Likewise.
	* g++.dg/concepts/partial-spec4.C: Likewise.
	* g++.dg/concepts/template-parm5.C: Likewise.
	* g++.dg/concepts/explicit-inst1.C: Likewise.
	* g++.dg/concepts/class-deduction1.C: Likewise.
	* g++.dg/concepts/class1.C: Likewise.
	* g++.dg/concepts/req15.C: Likewise.
	* g++.dg/concepts/memfun.C: Likewise.
	* g++.dg/concepts/pr68434.C: Likewise.
	* g++.dg/concepts/inherit-ctor4.C: Likewise.
	* g++.dg/concepts/partial-spec6.C: Likewise.
	* g++.dg/concepts/var-templ1.C: Likewise.
	* g++.dg/concepts/template-parm8.C: Likewise.
	* g++.dg/concepts/explicit-inst3.C: Likewise.
	* g++.dg/concepts/class4.C: Likewise.
	* g++.dg/concepts/req6.C: Likewise.
	* g++.dg/concepts/fn8.C: Likewise.
	* g++.dg/concepts/class5.C: Likewise.
	* g++.dg/concepts/placeholder5.C: Likewise.
	* g++.dg/concepts/req16.C: Likewise.
	* g++.dg/concepts/req10.C: Likewise.
	* g++.dg/concepts/var-concept2.C: Likewise.
	* g++.dg/concepts/auto3.C: Likewise.
	* g++.dg/concepts/generic-fn-err.C: Likewise.
	* g++.dg/concepts/pr65552.C: Likewise.
	* g++.dg/concepts/partial-concept-id2.C: Likewise.
	* g++.dg/concepts/fn1.C: Likewise.
	* g++.dg/concepts/partial-spec.C: Likewise.
	* g++.dg/concepts/template-parm12.C: Likewise.
	* g++.dg/concepts/diagnostic1.C: Likewise.
	* g++.dg/concepts/intro1.C: Likewise.
	* g++.dg/concepts/explicit-inst4.C: Likewise.
	* g++.dg/concepts/req18.C: Likewise.
	* g++.dg/concepts/explicit-spec5.C: Likewise.
	* g++.dg/concepts/var-concept6.C: Likewise.
	* g++.dg/concepts/fn9.C: Likewise.
	* g++.dg/concepts/req2.C: Likewise.
	* g++.dg/concepts/template-parm7.C: Likewise.
	* g++.dg/concepts/req14.C: Likewise.
	* g++.dg/concepts/template-parm6.C: Likewise.
	* g++.dg/concepts/variadic4.C: Likewise.
	* g++.dg/concepts/fn6.C: Likewise.
	* g++.dg/concepts/req-neg1.C: Likewise.
	* g++.dg/concepts/alias3.C: Likewise.
	* g++.dg/concepts/expression2.C: Likewise.
	* g++.dg/concepts/partial-spec3.C: Likewise.
	* g++.dg/concepts/expression3.C: Likewise.
	* g++.dg/concepts/memfun-err.C: Likewise.
	* g++.dg/concepts/pr66091.C: Likewise.
	* g++.dg/concepts/explicit-spec2.C: Likewise.
	* g++.dg/concepts/equiv.C: Likewise.
	* g++.dg/concepts/friend1.C: Likewise.
	* g++.dg/concepts/fn4.C: Likewise.
	* g++.dg/concepts/var-templ3.C: Likewise.
	* g++.dg/concepts/explicit-inst2.C: Likewise.
	* g++.dg/concepts/alias2.C: Likewise.
	* g++.dg/concepts/regress/alias-decl-42.C: Likewise.
	* g++.dg/concepts/placeholder6.C: Likewise.
	* g++.dg/concepts/fn10.C: Likewise.
	* g++.dg/concepts/req3.C: Likewise.
	* g++.dg/concepts/variadic2.C: Likewise.
	* g++.dg/concepts/pr65636.C: Likewise.
	* g++.dg/concepts/intro6.C: Likewise.
	* g++.dg/concepts/class2.C: Likewise.
	* g++.dg/concepts/fn2.C: Likewise.
	* g++.dg/concepts/req20.C: Likewise.
	* g++.dg/concepts/req8.C: Likewise.
	* g++.dg/concepts/placeholder1.C: Likewise.
	* g++.dg/concepts/pr65854.C: Likewise.
	* g++.dg/concepts/member-concept.C: Likewise.
	* g++.dg/concepts/template-parm2.C: Likewise.
	* g++.dg/concepts/variadic1.C: Likewise.
	* g++.dg/concepts/fn7.C: Likewise.
	* g++.dg/concepts/intro4.C: Likewise.
	* g++.dg/concepts/req13.C: Likewise.
	* g++.dg/concepts/inherit-ctor3.C: Likewise.
	* g++.dg/concepts/explicit-spec6.C: Likewise.
	* g++.dg/concepts/auto1.C: Likewise.
	* g++.dg/concepts/alias1.C: Likewise.
	* g++.dg/concepts/fn-concept1.C: Likewise.
	* g++.dg/concepts/template-parm11.C: Likewise.
	* g++.dg/concepts/explicit-spec4.C: Likewise.
	* g++.dg/concepts/partial-concept-id1.C: Likewise.
	* g++.dg/concepts/req9.C: Likewise.
	* g++.dg/concepts/req4.C: Likewise.
	* g++.dg/concepts/pr65681.C: Likewise.
	* g++.dg/concepts/req7.C: Likewise.
	* g++.dg/concepts/req12.C: Likewise.
	* g++.dg/concepts/fn5.C: Likewise.
	* g++.dg/concepts/alias4.C: Likewise.
	* g++.dg/concepts/generic-fn.C: Likewise.
	* g++.dg/concepts/feature-macro.C: Likewise.
	* g++.dg/concepts/req19.C: Likewise.
	* g++.dg/concepts/placeholder3.C: Likewise.
	* g++.dg/concepts/intro3.C: Likewise.
	* g++.dg/concepts/partial-spec5.C: Likewise.
	* g++.dg/concepts/template-parm4.C: Likewise.
	* g++.dg/concepts/dr1430.C: Likewise.
	* g++.dg/concepts/pr65634.C: Likewise.
	* g++.dg/concepts/var-concept4.C: Likewise.
	* g++.dg/concepts/pr67249.C: Likewise.
	* g++.dg/concepts/expression.C: Likewise.
	* g++.dg/concepts/pr65575.C: Likewise.
	* g++.dg/concepts/partial-spec2.C: Likewise.
	* g++.dg/concepts/template-parm9.C: Likewise.
	* g++.dg/concepts/inherit-ctor1.C: Likewise.
	* g++.dg/concepts/equiv2.C: Likewise.
	* g++.dg/concepts/req11.C: Likewise.
	* g++.dg/concepts/template-parm1.C: Likewise.
	* g++.dg/concepts/inherit-ctor2.C: Likewise.
	* g++.dg/concepts/var-concept1.C: Likewise.
	* g++.dg/concepts/fn3.C: Likewise.
	* g++.dg/torture/pr46364.C: Likewise.
	* g++.dg/torture/stackalign/eh-alloca-1.C: Likewise.
	* g++.dg/torture/stackalign/eh-fastcall-1.C: Likewise.
	* g++.dg/torture/stackalign/eh-vararg-1.C: Likewise.
	* g++.dg/torture/stackalign/eh-vararg-2.C: Likewise.
	* g++.dg/torture/stackalign/eh-global-1.C: Likewise.
	* g++.dg/torture/stackalign/eh-thiscall-1.C: Likewise.
	* g++.dg/torture/stackalign/eh-inline-2.C: Likewise.
	* g++.dg/torture/stackalign/eh-inline-1.C: Likewise.
	* g++.dg/torture/pr52918-1.C: Likewise.
	* g++.dg/torture/pr49394.C: Likewise.
	* g++.dg/torture/pr57190.C: Likewise.
	* g++.dg/cpp0x/static_assert8.C: Likewise.
	* g++.dg/cpp0x/noexcept19.C: Likewise.
	* g++.dg/cpp0x/variadic-throw.C: Likewise.
	* g++.dg/cpp0x/variadic73.C: Likewise.
	* g++.dg/cpp0x/noexcept02.C: Likewise.
	* g++.dg/cpp0x/defaulted23.C: Likewise.
	* g++.dg/cpp0x/noexcept08.C: Likewise.
	* g++.dg/cpp0x/auto9.C: Likewise.
	* g++.dg/cpp0x/lambda/lambda-eh2.C: Likewise.
	* g++.dg/cpp0x/error5.C: Likewise.
	* c-c++-common/gomp/atomic-12.c: Likewise.
	* c-c++-common/gomp/atomic-13.c: Likewise.
	* c-c++-common/gomp/atomic-14.c: Likewise.
	* c-c++-common/Wvarargs-2.c: Likewise.
	* c-c++-common/Wvarargs.c: Likewise.
	* c-c++-common/vector-subscript-2.c: Likewise.
	* g++.old-deja/g++.robertl/eb123.C: Likewise.
	* g++.old-deja/g++.eh/tmpl3.C: Likewise.
	* g++.old-deja/g++.eh/cleanup2.C: Likewise.
	* g++.old-deja/g++.eh/badalloc1.C: Likewise.
	* g++.old-deja/g++.eh/throw2.C: Likewise.
	* g++.old-deja/g++.eh/throw1.C: Likewise.
	* g++.old-deja/g++.eh/tmpl1.C: Likewise.
	* g++.old-deja/g++.other/new7.C: Likewise.
	* g++.old-deja/g++.other/crash30.C: Likewise.
	* g++.old-deja/g++.other/regstack.C: Likewise.
	* g++.old-deja/g++.other/crash28.C: Likewise.
	* g++.old-deja/g++.jason/bool5.C: Likewise.
	* g++.old-deja/g++.mike/p10416.C: Likewise.
	* g++.old-deja/g++.mike/eh25.C: Likewise.
	* g++.old-deja/g++.mike/eh55.C: Likewise.
libcpp/
	* include/cpplib.h (enum c_lang): Rename CLK_GNUCXX1Z
	to CLK_GNUCXX17 and CLK_CXX1Z to CLK_CXX17.
	* init.c (lang_defaults, cpp_init_builtins): Likewise.
	* expr.c (cpp_classify_number): Use C++17 instead of C++1z
	in diagnostics.
libstdc++-v3/
	* testsuite/libstdc++-prettyprinters/cxx17.cc: Use -std=c++17 or
	-std=gnu++17 instead of -std=c++1z or -std=gnu++1z.  Use c++17 instead
	of c++1z and c++17_only instead of c++1z_only.  Adjust expected
	diagnostics and comments refering to 1z to 17.
	* testsuite/30_threads/lock_guard/cons/deduction.cc: Likewise.
	* testsuite/30_threads/scoped_lock/cons/deduction.cc: Likewise.
	* testsuite/30_threads/scoped_lock/cons/1.cc: Likewise.
	* testsuite/30_threads/scoped_lock/requirements/typedefs.cc: Likewise.
	* testsuite/30_threads/scoped_lock/requirements/explicit_instantiation.cc:
	Likewise.
	* testsuite/30_threads/unique_lock/cons/deduction.cc: Likewise.
	* testsuite/18_support/launder/1.cc (test02): Likewise.
	* testsuite/18_support/launder/requirements_neg.cc: Likewise.
	* testsuite/18_support/launder/requirements.cc: Likewise.
	* testsuite/18_support/byte/requirements.cc: Likewise.
	* testsuite/18_support/byte/ops.cc: Likewise.
	* testsuite/18_support/byte/global_neg.cc: Likewise.
	* testsuite/18_support/uncaught_exceptions/uncaught_exceptions.cc:
	Likewise.
	* testsuite/27_io/types/4.cc: Likewise.
	* testsuite/25_algorithms/sample/81221.cc: Likewise.
	* testsuite/25_algorithms/sample/1.cc: Likewise.
	* testsuite/25_algorithms/sample/2.cc: Likewise.
	* testsuite/25_algorithms/search/searcher.cc: Likewise.
	* testsuite/28_regex/basic_regex/ctors/deduction.cc: Likewise.
	* testsuite/experimental/filesystem/path/construct/string_view.cc:
	Likewise.
	* testsuite/24_iterators/range_access_cpp17.cc: Likewise.
	* testsuite/24_iterators/container_access.cc: Likewise.
	* testsuite/ext/pb_ds/regression/hash_map_rand.cc: Likewise.
	* testsuite/ext/pb_ds/regression/trie_set_rand.cc: Likewise.
	* testsuite/ext/pb_ds/regression/hash_set_rand.cc: Likewise.
	* testsuite/ext/pb_ds/regression/list_update_set_rand.cc: Likewise.
	* testsuite/ext/pb_ds/regression/list_update_map_rand.cc: Likewise.
	* testsuite/ext/pb_ds/regression/priority_queue_rand.cc: Likewise.
	* testsuite/ext/pb_ds/regression/tree_set_rand.cc: Likewise.
	* testsuite/ext/pb_ds/regression/tree_map_rand.cc: Likewise.
	* testsuite/ext/pb_ds/regression/trie_map_rand.cc: Likewise.
	* testsuite/20_util/shared_ptr/casts/reinterpret.cc: Likewise.
	* testsuite/20_util/shared_ptr/cons/deduction.cc: Likewise.
	* testsuite/20_util/shared_ptr/cons/array.cc: Likewise.
	* testsuite/20_util/shared_ptr/observers/array.cc (struct A): Likewise.
	* testsuite/20_util/pair/cons/deduction.cc: Likewise.
	* testsuite/20_util/variant/deduction.cc: Likewise.
	* testsuite/20_util/tuple/78939.cc: Likewise.
	* testsuite/20_util/tuple/cons/deduction.cc: Likewise.
	* testsuite/20_util/void_t/1.cc: Likewise.
	* testsuite/20_util/duration/arithmetic/constexpr_c++17.cc: Likewise.
	* testsuite/20_util/unique_ptr/cons/deduction_neg.cc: Likewise.
	* testsuite/20_util/addressof/requirements/constexpr.cc: Likewise.
	* testsuite/20_util/weak_ptr/cons/deduction.cc: Likewise.
	* testsuite/20_util/has_unique_object_representations/requirements/typedefs.cc:
	Likewise.
	* testsuite/20_util/has_unique_object_representations/requirements/explicit_instantiation.cc:
	Likewise.
	* testsuite/20_util/has_unique_object_representations/value.cc:
	Likewise.
	* testsuite/20_util/time_point/arithmetic/constexpr.cc: Likewise.
	* testsuite/20_util/function_objects/invoke/59768.cc: Likewise.
	* testsuite/20_util/function_objects/mem_fn/80478.cc: Likewise.
	* testsuite/20_util/function/cons/deduction.cc: Likewise.
	* testsuite/20_util/specialized_algorithms/memory_management_tools/destroy_neg.cc:
	Likewise.
	* testsuite/20_util/is_aggregate/requirements/typedefs.cc: Likewise.
	* testsuite/20_util/is_aggregate/requirements/explicit_instantiation.cc:
	Likewise.
	* testsuite/20_util/is_aggregate/value.cc: Likewise.
	* testsuite/26_numerics/lcm/1.cc: Likewise.
	* testsuite/26_numerics/lcm/lcm_neg.cc: Likewise.
	* testsuite/26_numerics/gcd/1.cc: Likewise.
	* testsuite/26_numerics/gcd/gcd_neg.cc: Likewise.
	* testsuite/26_numerics/valarray/deduction.cc: Likewise.
	* testsuite/26_numerics/headers/cmath/types_std_c++0x_neg.cc: Likewise.
	* testsuite/26_numerics/headers/cmath/hypot.cc: Likewise.
	* testsuite/23_containers/queue/members/emplace_cxx17_return.cc:
	Likewise.
	* testsuite/23_containers/array/cons/deduction.cc: Likewise.
	* testsuite/23_containers/array/cons/deduction_neg.cc: Likewise.
	* testsuite/23_containers/deque/modifiers/emplace/cxx17_return.cc:
	Likewise.
	* testsuite/23_containers/deque/cons/deduction.cc: Likewise.
	* testsuite/23_containers/stack/members/emplace_cxx17_return.cc:
	Likewise.
	* testsuite/23_containers/list/modifiers/emplace/cxx17_return.cc:
	Likewise.
	* testsuite/23_containers/list/cons/deduction.cc: Likewise.
	* testsuite/23_containers/forward_list/modifiers/emplace_cxx17_return.cc:
	Likewise.
	* testsuite/23_containers/forward_list/cons/deduction.cc: Likewise.
	* testsuite/23_containers/unordered_set/allocator/ext_ptr.cc: Likewise.
	* testsuite/23_containers/vector/modifiers/emplace/cxx17_return.cc:
	Likewise.
	* testsuite/23_containers/vector/cons/deduction.cc: Likewise.
	* testsuite/23_containers/vector/bool/emplace_cxx17_return.cc:
	Likewise.
	* testsuite/21_strings/basic_string/cons/char/9.cc: Likewise.
	* testsuite/21_strings/basic_string/cons/char/deduction.cc: Likewise.
	* testsuite/21_strings/basic_string/cons/char/79162.cc: Likewise.
	* testsuite/21_strings/basic_string/cons/wchar_t/9.cc: Likewise.
	* testsuite/21_strings/basic_string/cons/wchar_t/deduction.cc:
	Likewise.
	* testsuite/21_strings/basic_string/cons/wchar_t/79162.cc: Likewise.
	* testsuite/21_strings/basic_string_view/modifiers/swap/char/1.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/modifiers/swap/wchar_t/1.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operations/compare/char/2.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operations/compare/char/70483.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operations/compare/wchar_t/2.cc:
	Likewise.
	* testsuite/21_strings/char_traits/requirements/constexpr_functions_c++17.cc:
	Likewise.

From-SVN: r252826
2017-09-15 18:15:46 +02: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 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 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 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
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
Tim Shen 3366a47408 re PR libstdc++/71500 (regex::icase only works on first character in a range)
PR libstdc++/71500
	* include/bits/regex_executor.tcc: Support icase in regex_tratis<...>
	for back reference matches.
	* testsuite/28_regex/regression.cc: Test case.

From-SVN: r251982
2017-09-11 19:02:34 +00:00
Jonathan Wakely 47d7966a70 Adjust test to pass with old std::string
* testsuite/21_strings/basic_string/lwg2946.cc: Adjust for
	compatibility with old COW std::string.

From-SVN: r251981
2017-09-11 17:54:57 +01:00
Daniel Kruegler df66af3b1e PR libstdc++/79162 implement LWG 2946 and LWG 2758
2017-09-04  Daniel Kruegler  <daniel.kruegler@gmail.com>

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

From-SVN: r251664
2017-09-04 16:48:47 +01:00
Jonathan Wakely 2c0378f467 PR libstdc++/81912 make std::__iterator_category constexpr
PR libstdc++/81912
	* include/bits/stl_iterator_base_types.h (__iterator_category): Add
	constexpr for C++11 and later.
	* testsuite/24_iterators/container_access.cc: Add target selector.
	* testsuite/24_iterators/range_access.cc: Fix clause number in
	comment.
	* testsuite/24_iterators/range_access_cpp14.cc: Likewise.
	* testsuite/24_iterators/range_access_cpp17.cc: New.

From-SVN: r251234
2017-08-21 16:14:27 +01:00
Richard Biener 1ea85365b4 re PR go/78628 (GO fails to build a translation unit decl)
2017-08-21  Richard Biener  <rguenther@suse.de>

	include/
	* simple-object.h (simple_object_copy_lto_debug_sections): New
	function.

	libiberty/
	* simple-object-common.h (struct simple_object_functions): Add
	copy_lto_debug_sections hook.
	* simple-object.c: Include fcntl.h.
	(handle_lto_debug_sections): New helper function.
	(simple_object_copy_lto_debug_sections): New function copying
	early LTO debug sections to regular debug sections in a new file.
	(simple_object_start_write): Handle NULL segment_name.
	* simple-object-coff.c (simple_object_coff_functions): Adjust
	for not implemented copy_lto_debug_sections hook.
	* simple-object-mach-o.c (simple_object_mach_o_functions): Likewise.
	* simple-object-xcoff.c (simple_object_xcoff_functions): Likewise.
	* simple-object-elf.c (SHT_NULL, SHT_SYMTAB, SHT_RELA, SHT_REL,
	SHT_GROUP): Add various sectopn header types.
	(SHF_EXCLUDE): Add flag.
	(Elf32_External_Sym, Elf64_External_Sym): Add symbol struct.
	(ELF_ST_BIND, ELF_ST_TYPE, ELF_ST_INFO): Add accessors.
	(STT_OBJECT, STT_FUNC, STT_TLS, STT_GNU_IFUNC): Add Symbol types.
	(STV_DEFAULT): Add symbol visibility.
	(SHN_COMMON): Add special section index name.
	(struct simple_object_elf_write): New.
	(simple_object_elf_start_write): Adjust for new private data.
	(simple_object_elf_write_shdr): Pass in values for all fields
	we write.
	(simple_object_elf_write_to_file): Adjust.  Copy from recorded
	section headers if requested.
	(simple_object_elf_release_write): Release private data.
	(simple_object_elf_copy_lto_debug_sections): Copy and rename sections
	as denoted by PFN and all their dependences, symbols and relocations
	to the empty destination file.
	(simple_object_elf_functions): Adjust for copy_lto_debug_sections hook.

        gcc/
        * debug.h (struct gcc_debug_hooks): Add die_ref_for_decl and
        register_external_die hooks.
        (debug_false_tree_charstarstar_uhwistar): Declare.
        (debug_nothing_tree_charstar_uhwi): Likewise.
        * debug.c (do_nothing_debug_hooks): Adjust.
        (debug_false_tree_charstarstar_uhwistar): New do nothing.
        (debug_nothing_tree_charstar_uhwi): Likewise.
        * dbxout.c (dbx_debug_hooks): Adjust.
        (xcoff_debug_hooks): Likewise.
        * sdbout.c (sdb_debug_hooks): Likewise.
        * vmsdbgout.c (vmsdbg_debug_hooks): Likewise.
        * dwarf2out.c (macinfo_label_base): New global.
	(dwarf2out_register_external_die): New function for the
	register_external_die hook.
        (dwarf2out_die_ref_for_decl): Likewise for die_ref_for_decl.
        (dwarf2_debug_hooks): Use them.
        (dwarf2_lineno_debug_hooks): Adjust.
        (struct die_struct): Add with_offset flag.
        (DEBUG_LTO_DWO_INFO_SECTION, DEBUG_LTO_INFO_SECTION,
        DEBUG_LTO_DWO_ABBREV_SECTION, DEBUG_LTO_ABBREV_SECTION,
        DEBUG_LTO_DWO_MACINFO_SECTION, DEBUG_LTO_MACINFO_SECTION,
        DEBUG_LTO_DWO_MACRO_SECTION, DEBUG_LTO_MACRO_SECTION,
        DEBUG_LTO_LINE_SECTION, DEBUG_LTO_DWO_STR_OFFSETS_SECTION,
        DEBUG_LTO_STR_DWO_SECTION, DEBUG_STR_LTO_SECTION): New macros
        defining section names for the early LTO debug variants.
	(reset_indirect_string): New helper.
        (add_AT_external_die_ref): Helper for dwarf2out_register_external_die.
        (print_dw_val): Add support for offsetted symbol references.
	(get_ultimate_context): Split out from is_cxx.
	(is_cxx): Use get_ultimate_context.
	(is_fortran): Add decl overload.
        (compute_comp_unit_symbol): Split out worker from
	compute_section_prefix.
        (compute_section_prefix): Call compute_comp_unit_symbol and
	set comdat_type_p here.
        (output_die): Skip DIE symbol output for the LTO added one.
        Handle DIE symbol references with offset.
        (output_comp_unit): Guard section name mangling properly.
        For LTO debug sections emit a symbol at the section beginning
        which we use to refer to its DIEs.
        (add_abstract_origin_attribute): For DIEs registered via
        dwarf2out_register_external_die directly refer to the early
        DIE rather than indirectly through the shadow one we created.
	Remove obsolete call to dwarf2out_abstract_function for
	non-function/block origins.
        (gen_array_type_die): When generating early LTO debug do
        not emit DW_AT_string_length.
        (gen_formal_parameter_die): Do not re-create DIEs for PARM_DECLs
        late when in LTO.  As suggested place a gcc_unreachable for
	the DECL_ABSTRACT_P case.
        (gen_subprogram_die): Avoid another specification DIE
        for early built declarations/definitions for the late LTO case.
        (gen_variable_die): Add type references for late duplicated VLA dies
        when in late LTO.
        (gen_inlined_subroutine_die): Do not call dwarf2out_abstract_function,
        we have the abstract instance already.
        (process_scope_var): Adjust decl DIE contexts in LTO which
        first puts them in limbo.
        (gen_decl_die): Do not generate type DIEs late apart from
        types for VLAs or for decls we do not yet have a DIE.  Do not
	call dwarf2out_abstract_function late.
        (dwarf2out_early_global_decl): Make sure to create DIEs
        for abstract instances of a decl first.
        (dwarf2out_late_global_decl): Adjust comment.
        (output_macinfo_op): With multiple macro sections use
	macinfo_label_base to distinguish labels.
        (output_macinfo): Likewise.  Update macinfo_label_base.
	Pass in the line info label.
	(note_variable_value_in_expr): When generating LTO resolve
	all variable values here by generating DIEs as needed.
        (init_sections_and_labels): Add early LTO debug flag parameter
        and generate different sections and names if set.  Add generation
        counter for the labels so we can have multiple of them.
        (reset_dies): Helper to allow DIEs to be output multiple times.
        (dwarf2out_finish): When outputting DIEs to the fat part of an
	LTO object first reset DIEs.
        (dwarf2out_early_finish): Output early DIEs when generating LTO.
	(modified_type_die): Check for decl_ultimate_origin being self
	before recursing.
	(gen_type_die_with_usage): Likewise.
	(gen_typedef_die): Allow decl_ultimate_origin being self.
        (set_decl_abstract_flags): Remove.
        (set_block_abstract_flags): Likewise.
        (dwarf2out_abstract_function): Treat the early generated DIEs
        as the abstract copy and only add DW_AT_inline and
        DW_AT_artificial here and call set_decl_origin_self.
	If the DIE has an abstract origin don't do anything.
	* tree.c (free_lang_data): Build a dummy TRANSLATION_UNIT_DECL
	if we have none yet (Go fails to build one, PR78628).
	(variably_modified_type_p): Prevent endless recursion for Ada
	cyclic pointer types.
        * lto-streamer-in.c: Include debug.h.
        (dref_queue): New global.
        (lto_read_tree_1): Stream in DIE references.
        (lto_input_tree): Register DIE references.
	(input_function): Stream DECL_DEBUG_ARGS.
        * lto-streamer-out.c: Include debug.h.
        (lto_write_tree_1): Output DIE references.
        (DFS::DFS_write_tree_body): Follow DECL_ABSTRACT_ORIGIN.
	Force a TRANSLATION_UNIT_DECL DECL_CONTEXT for file-scope decls.
	(output_function): Stream DECL_DEBUG_ARGS.
        * tree-streamer-in.c (lto_input_ts_decl_common_tree_pointers):
        Stream DECL_ABSTRACT_ORIGIN.
        * tree-streamer-out.c (write_ts_decl_common_tree_pointers): Likewise.
	(write_ts_decl_minimal_tree_pointers): Force a TRANSLATION_UNIT_DECL
	DECL_CONTEXT for file-scope decls.
        * lto-streamer.h (struct dref_entry): Declare.
        (dref_queue): Likewise.
	* cfgexpand.c (pass_expand::execute): Do not call the
	outlining_inline_function hook here.
        * lto-wrapper.c (debug_obj): New global.
        (tool_cleanup): Unlink it if required.
        (debug_objcopy): New function.
        (run_gcc): Handle early debug sections in the IL files by
        extracting them to separate files, partially linkin them and
        feeding the result back as result to the linker.

        * config/darwin.h (DEBUG_LTO_INFO_SECTION, DEBUG_LTO_ABBREV_SECTION,
        DEBUG_LTO_MACINFO_SECTION, DEBUG_LTO_LINE_SECTION,
        DEBUG_STR_LTO_SECTION, DEBUG_LTO_MACRO_SECTION): Put early debug
        sections into a separate segment.
        * config/darwin.c (darwin_asm_named_section): Handle __GNU_DWARF_LTO
        segments.
        (darwin_asm_dwarf_section): Likewise.
        (darwin_asm_output_dwarf_offset): Likewise.

	* config/i386/i386.c (make_resolver_func): Set DECL_IGNORED_P.

        lto/
        * lto.c (unify_scc): Truncate DIE reference queue for dropped SCCs.
        (lto_read_decls): Process TRANSLATION_UNIT_DECLs.  Remove
        TYPE_DECL debug processing, register DIE references from
        prevailing SCCs with the debug machinery.
        (lto_section_with_id): Handle LTO debug sections.

	libstdc++/
	* testsuite/libstdc++-prettyprinters/prettyprinters.exp: Run all
	tests with -flto as well if supported.

        testsuite/
	* c-c++-common/asan/global-overflow-1.c: Adjust diagnostic location
	regex to handle the LTO case.
	* c-c++-common/asan/heap-overflow-1.c: Likewise.
	* c-c++-common/asan/misalign-1.c: Likewise.
	* c-c++-common/asan/misalign-2.c: Likewise.
	* c-c++-common/asan/null-deref-1.c: Likewise.
	* c-c++-common/asan/stack-overflow-1.c: Likewise.
	* c-c++-common/asan/strncpy-overflow-1.c: Likewise.
	* c-c++-common/asan/use-after-free-1.c: Likewise.
	* c-c++-common/asan/alloca_big_alignment.c: Likewise.
	* c-c++-common/asan/alloca_detect_custom_size.c: Likewise.
	* c-c++-common/asan/alloca_overflow_partial.c: Likewise.
	* c-c++-common/asan/alloca_overflow_right.c: Likewise.
	* c-c++-common/asan/alloca_underflow_left.c: Likewise.
	* g++.dg/asan/large-func-test-1.C: Likewise.
	* gfortran.dg/save_6.f90: Add -flto -g variant of save_5.f90.

From-SVN: r251220
2017-08-21 10:29:00 +00:00
John David Anglin ab7fc02ec1 re PR testsuite/81056 (FAIL: 17_intro/names.cc (test for excess errors))
PR testsuite/81056
	* testsuite/17_intro/names.cc: Undef 'd' and 'r' on __hpux__

From-SVN: r251208
2017-08-20 18:52:59 +00:00
Jonathan Wakely 676c4146f5 PR libstdc++/81891 fix double-free in hashtable constructor
PR libstdc++/81891
	* include/bits/hashtable.h (_Hashtable(_InputIterator, _InputIterator,
	size_type, const _H1&, const _H2&, const _Hash&, const _Equal&,
	const _ExtractKey&, const allocator_type&)): Let destructor do clean
	up if an exception is thrown.
	* testsuite/23_containers/unordered_map/cons/81891.cc: New.

From-SVN: r251185
2017-08-18 18:46:57 +01:00
Jonathan Wakely 1ea93d89a9 PR libstdc++/81808 skip test if reading directory doesn't fail
PR libstdc++/81808
	* testsuite/27_io/basic_fstream/53984.cc: Adjust test for targets
	that allow opening a directory as a FILE and reading from it.

From-SVN: r251041
2017-08-11 01:14:57 +01:00
Jonathan Wakely 04d07b61cb PR libstdc++/81751 don't call fflush(NULL)
PR libstdc++/79820
	PR libstdc++/81751
	* config/io/basic_file_stdio.cc (sys_open(FILE*, ios_base::openmode)):
	Call fflush on the stream instead of calling sync() while _M_cfile is
	null. Restore original value of errno.
	* testsuite/ext/stdio_filebuf/char/79820.cc: New.
	* testsuite/ext/stdio_filebuf/char/81751.cc: New.

From-SVN: r250993
2017-08-09 18:52:10 +01:00
Jonathan Wakely 958dc0c224 PR libstdc++/53984 fix failing test
PR libstdc++/53984
	* testsuite/27_io/basic_fstream/53984.cc: Fix test.

From-SVN: r250594
2017-07-26 23:06:13 +01:00
Paolo Carlini 3b1aa533df 53984.cc: Fix typo in dg-require directive.
2017-07-26  Paolo Carlini  <paolo.carlini@oracle.com>

	* testsuite/27_io/basic_fstream/53984.cc: Fix typo in dg-require
	directive.

From-SVN: r250575
2017-07-26 14:13:15 +00: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 304a15ec64 PR libstdc++/81476 Optimise vector insertion from input iterators
PR libstdc++/81476
	* include/bits/vector.tcc (vector::_M_range_insert<_InputIterator>):
	Only insert elements one-by-one when inserting at the end.
	* testsuite/performance/23_containers/insert/81476.cc: New.

From-SVN: r250366
2017-07-19 20:32:15 +01:00
Jonathan Wakely 4e66b02bc1 Fix indentation in libstdc++ testsuite utils
* testsuite/util/testsuite_iterators.h: Fix indentation.

From-SVN: r250349
2017-07-19 15:49:00 +01:00
Jonathan Wakely 1f78c47bf0 Use dg-require-fileio in new test
* testsuite/27_io/basic_filebuf/sgetn/char/81395.cc: Add dg-require.

From-SVN: r250333
2017-07-19 01:23:00 +01:00
Jonathan Wakely fddcd19abf PR libstdc++/81395 fix crash when write follows large read
PR libstdc++/81395
	* include/bits/fstream.tcc (basic_filebuf::xsgetn): Don't set buffer
	pointers for write mode after reading.
	* testsuite/27_io/basic_filebuf/sgetn/char/81395.cc: New.

From-SVN: r250328
2017-07-19 00:39:34 +01:00
François Dumont 4f9e1f4d9d stl_list.h (struct _List_node_header): New.
2017-07-18  François Dumont  <fdumont@gcc.gnu.org>

	* include/bits/stl_list.h
	(struct _List_node_header): New.
	(_List_impl()): Fix noexcept qualification.
	(_List_impl(_List_impl&&)): New, default.
	(_List_base()): Default.
	(_List_base(_List_base&&)): Default.
	(_List_base::_M_move_nodes): Adapt to use
	_List_node_header._M_move_nodes.
	(_List_base::_M_init): Likewise.
	(list<>()): Default.
	(list<>(list&&)): Default.
	(list<>::_M_move_assign(list&&, true_type)): Use _M_move_nodes.
	(__distance(_List_const_iterator<>, _List_const_iterator<>,
	input_iterator_tag)): Adapt.
	* testsuite/23_containers/list/allocator/default_init.cc: New.

From-SVN: r250320
2017-07-18 20:26:08 +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 b0e90d2acf Include missing header for std::free
* testsuite/abi/pr42230.cc: Add header for std::free.

From-SVN: r250102
2017-07-10 19:43:02 +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
Jonathan Wakely 32aaf6ef10 Fix memory leaks in libstdc++ tests
* testsuite/20_util/specialized_algorithms/memory_management_tools/
	1.cc: Free memory.
	* testsuite/22_locale/locale/cons/5.cc: Remove redundant restoration
	of original environment and free memory.

From-SVN: r250021
2017-07-06 13:42:51 +01:00
Jonathan Wakely 4f7c2c7ff2 Fix memory leaks in libstdc++ ABI tests
* testsuite/abi/pr42230.cc: Free memory.
	* testsuite/util/testsuite_abi.cc (demangle): Return std::string
	instead of pointer that might need freeing.
	* testsuite/util/testsuite_abi.h (demangle): Likewise.
	* testsuite/util/testsuite_hooks.cc (verify_demangle): Free memory.

From-SVN: r250020
2017-07-06 13:42:46 +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
Jonathan Wakely 68fe5f441e PR libstdc++/81221 only run new test for check-parallel
PR libstdc++/81221
	* testsuite/25_algorithms/sample/81221.cc: Disable except for
	check-parallel.

From-SVN: r249697
2017-06-27 17:19:16 +01:00
Jonathan Wakely e708b94bb7 PR libstdc++/81221 fix namespace qualification for parallel mode
PR libstdc++/81221
	* include/bits/stl_algo.h (sample): Qualify with _GLIBCXX_STD_A not
	std.
	* testsuite/25_algorithms/sample/81221.cc: New.

From-SVN: r249692
2017-06-27 15:44:50 +01: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
Rainer Orth 67ea3f4e0f Always check for target i?86 and x86_64
libstdc++-v3:
	* testsuite/20_util/variant/index_type.cc: Allow for all ilp32 and
	lp64 targets.

	gcc/testsuite:
	* c-c++-common/fold-masked-cmp-1.c: Allow for i?86-*-* target.
	* c-c++-common/fold-masked-cmp-2.c: Likewise.
	* c-c++-common/fold-masked-cmp-3.c: Likewise.
	* g++.dg/cpp0x/alignas4.C: Allow for i?86-*-* target, don't
	restrict to x86_64-*-*-gnu.
	Skip scan-assembler on *-*-darwin*.
	* g++.dg/vect/pr70944.cc: Allow for i?86-*-* target.
	* gcc.dg/loop-invariant.c: Likewise.
	* gcc.dg/lto/pr70955_0.c: Likewise.
	* gcc.dg/tree-ssa/pr69196-1.c: Likewise.
	* gcc.dg/tree-ssa/pr79803.c: Likewise.
	* gfortran.dg/pr68078.f90: Allow for i?86-*-linux*.

	* g++.dg/debug/dwarf2/const2b.C: Allow for x86_64-*-* target.
	* gcc.dg/attr-ms_struct-1.c: Allow for all i?86-*-*, x86_64-*-*
	targets.
	* gcc.dg/attr-ms_struct-2.c: Likewise.
	* gcc.dg/attr-ms_struct-packed1.c: Likewise.
	* gcc.dg/bf-ms-layout.c: Likewise.
	* gcc.dg/bf-ms-layout-2.c: Likewise.
	* gcc.dg/pic-macro-define.c: Remove target restrictions.
	Require fpic support.
	* gcc.target/i386/bitfield1.c: Allow for all i?86-*-*, x86_64-*-*
	targets.
	* gcc.target/i386/bitfield2.c: Likewise.
	* gcc.target/i386/darwin-fpmath.c: Allow for x86_64-*-darwin*
	targets.
	* gfortran.dg/fmt_pf.f90: Remove i?86-*-solaris2.9* from xfail.

From-SVN: r249409
2017-06-20 13:01:32 +00:00
Rainer Orth 4f4b0ab85f Get rid of dg-skip-if etc. default args
libstdc++-v3:
	* testsuite: Remove dg-skip-if, dg-xfail-if, dg-xfail-run-if
	default args.

	libgomp:
	* testsuite/libgomp.fortran/strassen.f90: Remove dg-skip-if
	default args.
	* testsuite/libgomp.oacc-c-c++-common/vprop.c: Remove
	dg-xfail-run-if default args.

	gcc/testsuite:
	Remove dg-skip-if, dg-xfail-if, dg-xfail-run-if default args.

From-SVN: r249339
2017-06-17 15:32:28 +00:00
Jonathan Wakely 14d8a91212 PR libstdc++/80893 don't run test for C++98 modes
PR libstdc++/80893
	* testsuite/23_containers/vector/bool/80893.cc: Add { target c++11 }.

From-SVN: r249338
2017-06-17 13:11:47 +01:00
Jonathan Wakely 78a8b676f1 Add std::get_deleter overload with correct signature
* include/bits/shared_ptr.h (get_deleter): Add overload matching
	standard signature.
	* include/bits/shared_ptr_base.h (__shared_ptr): Declare new
	get_deleter overload as a friend.
	* testsuite/20_util/shared_ptr/misc/get_deleter.cc: New.

From-SVN: r249267
2017-06-16 16:20:14 +01:00
Jonathan Wakely bfe8a528aa Fix std::wbuffer_convert::sync()
* include/bits/locale_conv.h (wbuffer_convert::sync): Fix condition.
	* testsuite/22_locale/conversions/buffer/2.cc: New.

From-SVN: r249255
2017-06-16 14:23:42 +01:00
Jonathan Wakely 4317778a9b PR libstdc++/81092 add std::wstring symbols and bump library version
PR libstdc++/81092
	* acinclude.m4: Bump libtool_VERSION.
	* config/abi/post/i386-linux-gnu/baseline_symbols.txt: Update.
	* config/abi/post/x86_64-linux-gnu/32/baseline_symbols.txt: Update.
	* config/abi/pre/gnu.ver: Add wstring constructor symbols to
	GLIBCXX_3.4.24 version and move random_device::_M_get_entropy() symbol
	to new GLIBCXX_3.4.25 version.
	* doc/xml/manual/abi.xml: Document new versions.
	* doc/html/*: Regenerate.
	* testsuite/21_strings/basic_string/cons/char/8.cc: Use base object
	constructors to ensure required symbols are exported.
	* testsuite/21_strings/basic_string/cons/wchar_t/8.cc: Likewise.
	* testsuite/util/testsuite_abi.cc: Add new version.

From-SVN: r249246
2017-06-16 12:54:59 +01:00
Jonathan Wakely 6ec3c9c841 Fix missing returns in libstdc++ header and tests
* include/bits/locale_conv.h (wbuffer_convert::_M_put): Add missing
	return statement.
	* testsuite/21_strings/basic_string_view/operations/copy/char/1.cc:
	Return void.
	* testsuite/21_strings/basic_string_view/operations/copy/wchar_t/1.cc:
	Likewise.
	* testsuite/23_containers/map/modifiers/insert_or_assign/1.cc: Add
	missing return statements.
	* testsuite/23_containers/unordered_map/modifiers/insert_or_assign.cc:
	Likewise.
	* testsuite/27_io/basic_istream/extractors_arithmetic/char/12.cc:
	Return void.
	* testsuite/special_functions/14_expint/pr68397.cc: Likewise.

From-SVN: r249238
2017-06-16 09:13:37 +01:00
François Dumont 7d594224c2 stl_bvector.h (__fill_bvector(_Bit_type*, unsigned int, unsigned int, bool)): Change signature.
2017-06-16  François Dumont  <fdumont@gcc.gnu.org>

	* include/bits/stl_bvector.h
	(__fill_bvector(_Bit_type*, unsigned int, unsigned int, bool)):
	Change signature.
	(std::fill(_Bit_iterator, _Bit_iterator, bool)): Adapt.
	(_Bvector_impl_data): New.
	(_Bvector_impl): Inherits from latter.
	(_Bvector_impl(_Bit_alloc_type&&)): Delete.
	(_Bvector_impl(_Bvector_impl&&)): New, default.
	(_Bvector_base()): Default.
	(_Bvector_base(_Bvector_base&&)): Default.
	(_Bvector_base::_M_move_data(_Bvector_base&&)): New.
	(vector(vector&&, const allocator_type&)): Use latter.
	(vector<bool>::operator=(vector&&)): Likewise.
	(vector<bool>::vector()): Default.
	(vector<bool>::vector(vector&&)): Default.
	(vector<bool>::assign(_InputIterator, _InputIterator)): Use
	_M_assign_aux.
	(vector<bool>::assign(initializer_list<bool>)): Likewise.
	(vector<bool>::_M_initialize_value(bool)): New.
	(vector<bool>(size_type, const bool&, const allocator_type&)): Use
	latter.
	(vector<bool>::_M_initialize_dispatch(_Integer, _Integer, __true_type)):
	Likewise.
	(vector<bool>::_M_fill_assign(size_t, bool)): Likewise.

From-SVN: r249235
2017-06-16 05:28:06 +00:00
Rainer Orth d12366802a Use pthread effective-target in testsuite
* testsuite: Add dg-require-effective-target pthread to -pthread
	tests.
	Remove explicit target lists from dg-do and dg-options.

	* testsuite/30_threads/async/forced_unwind.cc: Remove explit
	target list from dg-options.
	* testsuite/30_threads/packaged_task/forced_unwind.cc: Likewise.

	* 30_threads/shared_mutex/cons/1.cc: Likewise.
	Pass -pthread for all targets.
	* 30_threads/shared_mutex/try_lock/1.cc: Likewise.
	* 30_threads/shared_mutex/try_lock/2.cc: Likewise.
	* 30_threads/shared_mutex/unlock/1.cc: Likewise.

	* testsuite/30_threads/this_thread/57060.cc: Require c++11 via
	dg-require-effective-target.

From-SVN: r249217
2017-06-15 12:18:05 +00:00
Jonathan Wakely cdd17d6e99 Fix libstdc++ testsuite failures with -D_GLIBCXX_USE_CXX11_ABI=0
* doc/xml/manual/test.xml: Correct instructions on running tests.
	* testsuite/21_strings/basic_string/cons/char/deduction.cc: Adjust to
	pass when -D_GLIBCXX_USE_CXX11_ABI=0 added to RUNTESTFLAGS.
	* testsuite/21_strings/basic_string/cons/wchar_t/deduction.cc:
	Likewise.
	* testsuite/27_io/basic_ios/copyfmt/char/1.cc: Likewise.
	* testsuite/27_io/basic_ios/exceptions/char/1.cc: Likewise.
	* testsuite/27_io/basic_istream/extractors_arithmetic/char/
	exceptions_failbit.cc: Likewise.
	* testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/
	exceptions_failbit.cc: Likewise.
	* testsuite/27_io/basic_istream/extractors_other/char/
	exceptions_null.cc: Likewise.
	* testsuite/27_io/basic_istream/extractors_other/wchar_t/
	exceptions_null.cc: Likewise.
	* testsuite/27_io/basic_istream/sentry/char/12297.cc: Likewise.
	* testsuite/27_io/basic_istream/sentry/wchar_t/12297.cc: Likewise.
	* testsuite/27_io/basic_ostream/inserters_other/char/
	exceptions_null.cc: Likewise.
	* testsuite/27_io/basic_ostream/inserters_other/wchar_t/
	exceptions_null.cc: Likewise.
	* testsuite/27_io/ios_base/storage/2.cc: Likewise.

From-SVN: r249206
2017-06-14 20:38:30 +01:00
Pedro Alves b51483f48f Finish implementing P0426R1 "Constexpr for std::char_traits" for C++17
As discussed in PR c++/80265 ("__builtin_{memcmp,memchr,strlen} are
not usable in constexpr functions"), use __builtin_constant_p to tell
whether we can defer to a constexpr algorithm.

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

Changes like these:

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

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

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

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

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

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

From-SVN: r249137
2017-06-12 22:22:39 +00:00
François Dumont 07cfc2d75d stl_tree.h (_Rb_tree_impl()): Restore _Node_allocator default init.
2017-06-12  François Dumont  <fdumont@gcc.gnu.org>

	* include/bits/stl_tree.h (_Rb_tree_impl()): Restore _Node_allocator
	default init.
	* testsuite/util/testsuite_allocator.h
	(__gnu_test::default_init_allocator<>) New.
	* testsuite/23_containers/set/allocator/default_init.cc: New.
	* testsuite/23_containers/map/allocator/default_init.cc: New.

From-SVN: r249136
2017-06-12 20:38:16 +00:00
Jonathan Wakely 754d67d5ba PR libstdc++/55917 do not handle exceptions in std::thread
PR libstdc++/55917
	* src/c++11/thread.cc (execute_native_thread_routine): Remove
	try-block so that exceptions propagate out of the thread and terminate
	is called by the exception-handling runtime.
	(execute_native_thread_routine_compat): Likewise.
	* testsuite/30_threads/thread/cons/terminate.cc: New.

From-SVN: r249130
2017-06-12 17:37:28 +01:00
Jonathan Wakely 53d01fd9e9 Support move-only deleters in std::shared_ptr (LWG 2802)
* doc/xml/manual/intro.xml: Document LWG 2802, 2873 and 2942 changes.
	* include/bits/shared_ptr.h (shared_ptr): Use rvalues for deleters
	(LWG 2802).
	* include/bits/shared_ptr_base.h (_Sp_ebo_helper, _Sp_counted_deleter
	(_Sp_counted_deleter::_Impl, __shared_count, __shared_ptr): Likewise.
	* testsuite/20_util/shared_ptr/cons/lwg2802.cc: New.

From-SVN: r249061
2017-06-09 14:20:37 +01:00
Jonathan Wakely 225ab2b07b Add deduction guides for sequence containers (P0433R2, partial)
* include/bits/forward_list.h (forward_list): Add deduction guide.
	* include/bits/stl_deque.h (deque): Likewise.
	* include/bits/stl_list.h (list): Likewise.
	* include/bits/stl_vector.h (vector): Likewise.
	* testsuite/23_containers/deque/cons/deduction.cc: New.
	* testsuite/23_containers/forward_list/cons/deduction.cc: New.
	* testsuite/23_containers/list/cons/deduction.cc: New.
	* testsuite/23_containers/vector/cons/deduction.cc: New.

From-SVN: r249054
2017-06-09 12:04:53 +01:00
Jonathan Wakely 853ed6bc10 PR libstdc++/81017 add noexcept to std::function move operations
PR libstdc++/81017
	* include/bits/std_function.h (function::function(function&&))
	(function::operator=(funtion&&)): Add noexcept.
	* testsuite/20_util/function/assign/move.cc: Check for noexcept.
	* testsuite/20_util/function/cons/move.cc: Likewise.

From-SVN: r249018
2017-06-08 15:27:45 +01:00
Jonathan Wakely bfd88d1df1 Add C++17 deduction guide for std::basic_regex (P0433R2, partial)
* include/bits/regex.h (basic_regex): Add deduction guide from P0433.
	* testsuite/28_regex/basic_regex/ctors/deduction.cc: New.

From-SVN: r248990
2017-06-07 16:43:54 +01:00
Jonathan Wakely d840779ff4 PR libstdc++/81002 fix std::basic_regex range constructor
PR libstdc++/81002
	* include/bits/regex.h (basic_regex): Adjust call to __compile_nfa
	so iterator type is deduced.
	* include/bits/regex_compiler.h (__compile_nfa): Reorder template
	parameters to allow iterator type to be deduced.
	* testsuite/28_regex/basic_regex/ctors/basic/iter.cc: New.

From-SVN: r248989
2017-06-07 16:43:35 +01:00
Jonathan Wakely 6d82c56288 Add C++17 deduction guide for std::basic_string (P0433R2, partial)
* include/bits/alloc_traits.h (__is_allocator, _RequireAllocator):
	New trait and alias for detecting Allocator-like types.
	* include/bits/basic_string.h (basic_string): Add deduction guide
	from P0433.
	* include/ext/alloc_traits.h (__gnu_cxx::__alloc_traits): Add template
	parameter with default template argument that causes substitution
	failures for types that cannot be allocators.
	* testsuite/21_strings/basic_string/cons/char/deduction.cc: New.
	* testsuite/21_strings/basic_string/cons/wchar_t/deduction.cc: New.

From-SVN: r248967
2017-06-07 13:35:08 +01:00
Jonathan Wakely d08606ce6c Add noexcept to shared_ptr owner comparisons (LWG 2873)
* include/bits/shared_ptr_base.h (__shared_ptr::owner_before)
	(__weak_ptr::owner_before, _Sp_owner_less::operator()): Add noexcept
	specifiers as per LWG 2873 and LWG 2942.
	* testsuite/20_util/owner_less/noexcept.cc: New.
	* testsuite/20_util/shared_ptr/observers/owner_before.cc: Test
	noexcept guarantees.
	* testsuite/20_util/weak_ptr/observers/owner_before.cc: Likewise.

From-SVN: r248874
2017-06-05 10:33:19 +01:00
Jonathan Wakely 4c19e432d6 PR libstdc++/80624 satisfy invariant for char_traits<char16_t>::eof()
PR libstdc++/80624
	* doc/xml/manual/status_cxx2011.xml: Document to_int_type behaviour.
	* include/bits/char_traits.h (char_traits<char16_t>::to_int_type):
	Transform eof value to U+FFFD.
	* testsuite/21_strings/char_traits/requirements/char16_t/eof.cc: New.
	* testsuite/27_io/basic_streambuf/sgetc/char16_t/80624.cc: New.
	* testsuite/27_io/basic_streambuf/sputc/char16_t/80624.cc: New.

From-SVN: r248843
2017-06-02 19:35:37 +01:00
Ville Voutilainen e257141f07 re PR c++/80812 (ICE: in build_value_init_noctor, at cp/init.c:483)
PR c++/80812

cp/

PR c++/80812
* method.c (constructible_expr): Strip array types before calling
build_value_init.

libstdc++/

PR c++/80812
* testsuite/20_util/is_constructible/80812.cc: New.

From-SVN: r248788
2017-06-01 14:09:41 +03:00
Jonathan Wakely 046a84762b PR libstdc++/80893 Fix null dereference in vector<bool>
PR libstdc++/80893
	* include/bits/stl_bvector.h (vector<bool>::_M_initialize): Avoid
	null pointer dereference when size is zero.
	* testsuite/23_containers/vector/bool/80893.cc: New.
	* testsuite/util/testsuite_allocator.h (PointerBase::PointerBase):
	Add non-explicit constructor from nullptr.
	(PointerBase::derived() const): Add const-qualified overload.

From-SVN: r248734
2017-05-31 13:41:45 +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
Xi Ruoyao 78aa76df40 PR libstdc++/67578 Implement non-trivial std::random_device::entropy
2017-05-23  Xi Ruoyao  <ryxi@stu.xidian.edu.cn>
	    Jonathan Wakely  <jwakely@redhat.com>

	PR libstdc++/67578
	* acinclude.m4: Bump libtool_VERSION.
	* config/abi/pre/gnu.ver: Create GLIBCXX_3.4.24 with new symbol.
	* config.h.in: Regenerate.
	* configure: Regenerate.
	* configure.ac: Add test for <linux/random.h>.
	* doc/xml/manual/abi.xml: Document new library version.
	* include/bits/random.h (random_device::entropy)
	[_GLIBCXX_USE_RANDOM_TR1]: Add call to new _M_getentropy member.
	(random_device::_M_getentropy): Declare.
	* src/c++11/random.cc (random_device::_M_getentropy): Define.
	* testsuite/util/testsuite_abi.cc: Add GLIBCXX_3.4.24 to known
	versions, and make it the latest version.

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

From-SVN: r248374
2017-05-23 17:11:57 +01:00
Jonathan Wakely f710ca61ba PR libstdc++/80796 Add new std::search overload for C++17
PR libstdc++/80796
	* include/bits/stl_algo.h (search): Add new overload for C++17.
	* testsuite/25_algorithms/search/searcher.cc: New.

From-SVN: r248266
2017-05-19 13:11:31 +01: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
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
Jonathan Wakely 058c785479 Test source_location::current() in default member initializer
* testsuite/experimental/source_location/1.cc: Change expected result
	for source_location::current() used in default member initializer.

From-SVN: r248111
2017-05-16 15:26:14 +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
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 85c05b5eec Fix order and types of members in C++17 insert_return_type structs
PR libstdc++/80761
	* include/bits/node_handle.h (_Node_insert_return): Reorder members.
	(tuple_size, tuple_element): Remove partial specializations.
	* include/bits/stl_tree.h (_Rb_tree::insert_return_type): Use
	const_iterator for std::set.
	* testsuite/23_containers/map/modifiers/extract.cc: New.
	* testsuite/23_containers/set/modifiers/extract.cc: New.
	* testsuite/23_containers/unordered_map/modifiers/extract.cc: New.
	* testsuite/23_containers/unordered_set/modifiers/extract.cc: New.

From-SVN: r248062
2017-05-15 14:47:40 +01: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
Jonathan Wakely f8cba3aaae PR libstdc++/80285 optimize std::make_shared for -fno-rtti
PR libstdc++/80285
	* include/bits/shared_ptr_base.h (_Sp_make_shared_tag::_S_ti): Define
	function to get unique fake std::type_info reference.
	(_Sp_counted_ptr_inplace::_M_get_deleter) [!__cpp_rtti]: Compare to
	_S_ti() fake reference.
	(__shared_ptr(_Sp_make_shared_tag, const Alloc&, Args&&...)): Share
	single implementation with or without RTTI enable.
	[!__cpp_rtti]: Pass fake reference to _M_get_deleter.
	* testsuite/20_util/shared_ptr/creation/alloc.cc: Change expected
	allocation and deallocation counts.
	* testsuite/20_util/shared_ptr/creation/single_allocation.cc: New.
	* testsuite/20_util/shared_ptr/creation/single_allocation_no_rtti.cc:
	New.

From-SVN: r247905
2017-05-11 14:21:07 +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
Jason Merrill e91c2cac34 * testsuite/24_iterators/container_access.cc (test03): Make il3 static.
From-SVN: r247799
2017-05-09 11:11:19 -04: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
François Dumont 30fc569c18 48362.cc: Replace a regexp-test by a note-test.
2017-04-29  François Dumont  <fdumont@gcc.gnu.org>

	* testsuite/libstdc++-prettyprinters/48362.cc: Replace a regexp-test
	by a note-test.

From-SVN: r247411
2017-04-29 19:35:28 +00:00
Jonathan Wakely b26f45f069 PR libstdc++/80553 don't allow destroying non-destructible types
PR libstdc++/80553
	* include/bits/stl_construct.h (_Destroy, _Destroy_n): Add static
	assertions to ensure type is destructible.
	(destroy_at, destroy, destroy_n): Move from stl_uninitialized.h.
	* include/bits/stl_uninitialized.h (destroy_at, destroy, destroy_n):
	Move to stl_construct.h.
	* testsuite/20_util/specialized_algorithms/memory_management_tools/
	destroy_neg.cc: New test.
	* testsuite/23_containers/vector/cons/destructible_neg.cc: New test.

From-SVN: r247379
2017-04-28 13:56:53 +01:00
Jonathan Wakely 38233afdcf Remove superfluous "" in dg-error.
* testsuite/17_intro/headers/c++1998/stdc++_assert_neg.cc: Remove
	superfluous "" in dg-error.

From-SVN: r247378
2017-04-28 13:56:38 +01:00
Tom de Vries f166beaf42 Remove superfluous '{ target *-*-* }' in dg-(error|warning|message|bogus)
find $(find -type d -name testsuite) -type f \
     | xargs sed -ri \
       's#(dg-(error|warning|message|bogus).*) \{ target \*-\*-\* \} \}#\1 }#'

2017-04-28  Tom de Vries  <tom@codesourcery.com>

	* g++.dg/parse/error2.C: Remove superfluous '{ target *-*-* }' in
	dg-(error|warning|message|bogus).
	* g++.dg/parse/parameter-declaration-1.C: Same.
	* g++.dg/warn/Wstrict-aliasing-float-ref-int-obj.C: Same.
	* gcc.dg/Wpointer-sign-Wall.c: Same.
	* gcc.dg/Wpointer-sign-pedantic.c: Same.
	* gcc.dg/cpp/19990413-1.c: Same.
	* gcc.dg/dg-test-1.c: Same.
	* gcc.dg/empty-source-2.c: Same.
	* gcc.dg/empty-source-3.c: Same.
	* gcc.dg/format/c99-printf-1.c: Same.
	* gcc.dg/format/c99-scanf-1.c: Same.
	* gcc.dg/label-decl-2.c: Same.
	* gcc.dg/m-un-2.c: Same.
	* gcc.dg/uninit-pr20644-O0.c: Same.
	* gfortran.dg/pr70006.f90: Same.
	* obj-c++.dg/fsf-package-0.m: Same.

	* testsuite/17_intro/headers/c++1998/stdc++_assert_neg.cc: Remove
	superfluous '{ target *-*-* }' in dg-(error|warning|message|bogus).

From-SVN: r247364
2017-04-28 07:26:32 +00:00
Jonathan Wakely 4ca4927ac6 Remove reundant const-qualification from cast targets
* include/ext/pb_ds/detail/list_update_map_/iterators_fn_imps.hpp
	(PB_DS_CLASS_C_DEC::end()): Remove redundant const in cast type.
	* testsuite/util/testsuite_rng.h (twister_rand_gen::get_prob()):
	Likewise.

From-SVN: r247346
2017-04-27 16:17:05 +01:00
Jonathan Wakely 9425300b41 Improve tests for vector and deque move-assignment
* testsuite/23_containers/deque/allocator/move_assign-2.cc: Improve
	comment. Ensure first test works because allocator type propagates and
	not because is_always_equal is true.
	* testsuite/23_containers/vector/52591.cc: Likewise. Restore original
	testcase that instantiates the move-assignment operator.

From-SVN: r247284
2017-04-26 20:25:30 +01:00
Jonathan Wakely 6e2e575a03 PR libstdc++/80504 qualify calls to avoid ADL
PR libstdc++/80504
	* include/bits/refwrap.h (ref, cref): Qualify calls.
	* testsuite/20_util/reference_wrapper/80504.cc: New test.

From-SVN: r247094
2017-04-24 12:40:07 +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 a2c0a1942c Avoid deprecated warnings about std::auto_ptr in library headers
* include/backward/auto_ptr.h: Ignore deprecated warnings from use
	of auto_ptr.
	* include/bits/shared_ptr.h: Likewise.
	* include/bits/shared_ptr_base.h: Likewise.
	* include/bits/unique_ptr.h: Likewise.
	* libstdc++-v3/testsuite/20_util/default_delete/48631_neg.cc: Adjust
	dg-error lineno.
	* libstdc++-v3/testsuite/20_util/default_delete/void_neg.cc: Likewise.
	* libstdc++-v3/testsuite/20_util/unique_ptr/assign/48635_neg.cc:
	Likewise.
	* libstdc++-v3/testsuite/20_util/unique_ptr/cons/cv_qual_neg.cc:
	Likewise.

From-SVN: r247063
2017-04-21 14:08:51 +01:00
Edward Smith-Rowland 4ba07ed462 PR libstdc++/68397 std::tr1::expint fails ... long double arguments.
2017-04-20  Edward Smith-Rowland  <3dw4rd@verizon.net>

	PR libstdc++/68397 std::tr1::expint fails ... long double arguments.
	* include/tr1/exp_integral.tcc: Increase iteration limits.
	* testsuite/tr1/5_numerical_facilities/special_functions/15_expint/
	pr68397.cc: New test.
	* testsuite/special_functions/14_expint/pr68397.cc: New test.

From-SVN: r247027
2017-04-20 15:41:59 +00: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
Jonathan Wakely b1e282ca18 Uncomment std::reference_wrapper tests that no longer fail
* testsuite/20_util/reference_wrapper/invoke.cc: Uncomment tests
	that no longer fail.

From-SVN: r246658
2017-04-03 18:16:11 +01:00
Jonathan Wakely 59c06f4d56 Fix comments in libstdc++ header and test
* include/bits/ios_base.h: Correct comment.
	* testsuite/util/testsuite_hooks.h: Likewise.

From-SVN: r246657
2017-04-03 18:16:06 +01:00
Jonathan Wakely 8c3b5c719f Implement P0426R1 "Constexpr for std::char_traits" for C++17 (partial)
* include/bits/char_traits.h (__gnu_cxx::char_traits): Add
	_GLIBCXX14_CONSTEXPR on assign, compare, find, and length.
	(std::char_traits<char>, std::char_traits<wchar_t>): Add
	_GLIBCXX17_CONSTEXPR on assign.
	(std::char_traits<char16_t>, std::char_traits<char32_t>): Add
	_GLIBCXX17_CONSTEXPR on assign, compare, find, and length.
	* testsuite/21_strings/char_traits/requirements/
	constexpr_functions_c++17.cc: New test.

From-SVN: r246655
2017-04-03 18:15:53 +01:00
Ville Voutilainen c1e2889a32 re PR libstdc++/79141 (std::pair<int,int> p = {}; fails to compile due to ambiguous overload)
PR libstdc++/79141
* include/bits/stl_pair.h (__nonesuch_no_braces): New.
(operator=(typename conditional<
__and_<is_copy_assignable<_T1>,
is_copy_assignable<_T2>>::value,
const pair&, const __nonesuch&>::type)): Change __nonesuch
to __nonesuch_no_braces.
(operator=(typename conditional<
__not_<__and_<is_copy_assignable<_T1>,
is_copy_assignable<_T2>>>::value,
const pair&, const __nonesuch&>::type)): Likewise.
(operator=(typename conditional<
__and_<is_move_assignable<_T1>,
is_move_assignable<_T2>>::value,
pair&&, __nonesuch&&>::type)): Likewise.
* testsuite/20_util/pair/79141.cc: New.

From-SVN: r246653
2017-04-03 19:30:58 +03:00
Ville Voutilainen e2ac6765db Implement std::is_aggregate.
* include/std/type_traits (is_aggregate, is_aggregate_v): New.
* testsuite/20_util/is_aggregate/requirements/explicit_instantiation.cc:
New.
* testsuite/20_util/is_aggregate/requirements/typedefs.cc: Likewise.
* testsuite/20_util/is_aggregate/value.cc: Likewise.

From-SVN: r246651
2017-04-03 18:57:06 +03:00
Ville Voutilainen 250f5b6cc1 Implement LWG 2900, The copy and move constructors of optional are not constexpr.
Implement LWG 2900, The copy and move constructors
of optional are not constexpr.
* include/std/optional (_Optional_payload): New.
(_Optional_base): Remove the bool parameter.
(_Optional_base<_Tp, false>): Remove.
(_Optional_base()): Adjust.
(_Optional_base(nullopt_t)): Likewise.
(_Optional_base(in_place_t, _Args&&...)): Likewise.
(_Optional_base(in_place_t, initializer_list<_Up>, _Args&&...)):
Likewise.
(_Optional_base(const _Optional_base&)): Likewise.
(_Optional_base(_Optional_base&&)): Likewise.
(operator=(const _Optional_base&)): Likewise.
(operator=(_Optional_base&&)): Likewise.
(~_Optional_base()): Remove.
(_M_is_engaged()): Adjust.
(_M_get()): Likewise.
(_M_construct(_Args&&...)): Likewise.
(_M_destruct()): Likewise.
(_M_reset()): Likewise.
(_Optional_base::_Empty_byte): Remove.
(_Optional_base::_M_empty): Remove.
(_Optional_base::_M_payload): Adjust.
* testsuite/20_util/optional/cons/value_neg.cc: Adjust.
* testsuite/20_util/optional/constexpr/cons/value.cc: Add tests.

From-SVN: r246556
2017-03-29 02:05:21 +03:00
Jonathan Wakely 92d85953a5 PR libstdc++/80137 use std::nextafter instead of looping
PR libstdc++/80137
	* include/bits/random.tcc (generate_canonical): Use std::nextafter
	or numeric_limits::epsilon() to reduce out-of-range values.
	* testsuite/26_numerics/random/uniform_real_distribution/operators/
	64351.cc: Verify complexity requirement is met.

From-SVN: r246542
2017-03-28 17:09:49 +01:00
Jonathan Wakely b1bd915843 PR libstdc++/80229 restore support for shared_ptr<function type>
PR libstdc++/80229
	* include/bits/shared_ptr_base.h
	(__shared_ptr::_M_enable_shared_from_this_with): Change parameters to
	non-const and then use remove_cv to get unqualified type.
	* testsuite/20_util/enable_shared_from_this/members/const.cc: Don't
	cast away constness on object created const.
	* testsuite/20_util/shared_ptr/cons/80229.cc: New test.

From-SVN: r246520
2017-03-28 08:35:04 +01:00
Jonathan Wakely 01e3c2296a Fix Debug Mode test failures
* testsuite/23_containers/array/tuple_interface/
	tuple_element_debug_neg.cc: Adjust dg-error.
	* testsuite/23_containers/list/operations/78389.cc: Fix less-than to
	define a valid strict weak ordering.
	* testsuite/23_containers/priority_queue/67085.cc: Disable test for
	Debug Mode, due to debug checks making extra copies of predicate.
	* testsuite/ext/pb_ds/regression/priority_queue_binary_heap-62045.cc:
	Likewise.

From-SVN: r246426
2017-03-23 19:40:41 +00:00
Daniel Kruegler 7f359d19d0 Implement LWG 2686, std::hash<error_condition>, for C++17
2017-03-23  Daniel Kruegler  <daniel.kruegler@gmail.com>

	Implement LWG 2686, Why is std::hash specialized for error_code,
	but not error_condition?
	* include/std/system_error (hash<error_condition>): Define for C++17.
	* testsuite/20_util/hash/operators/size_t.cc (hash<error_condition>):
	Instantiate test for error_condition.
	* testsuite/20_util/hash/requirements/explicit_instantiation.cc
	(hash<error_condition>): Instantiate hash<error_condition>.

From-SVN: r246424
2017-03-23 19:40:16 +00:00
Daniel Kruegler 288695f7a4 Implement P0607R0 "Inline Variables for Standard Library" for C++17
2017-03-23  Daniel Kruegler  <daniel.kruegler@gmail.com>

	* include/bits/c++config (_GLIBCXX17_INLINE): Define.
	* include/bits/regex_constants.h (All std::regex_constants constants):
	Add _GLIBCXX17_INLINE as per P0607R0.
	* include/bits/std_mutex.h (defer_lock, try_to_lock, adopt_lock):
	Likewise.
	* include/bits/stl_pair.h (piecewise_construct): Likewise.
	* include/bits/uses_allocator.h (allocator_arg, uses_allocator_v)
	(__is_uses_allocator_constructible_v)
	(__is_nothrow_uses_allocator_constructible_v): Likewise.
	* include/std/chrono (treat_as_floating_point_v): Likewise.
	* include/std/functional (is_bind_expression_v, is_placeholder_v):
	Likewise.
	* include/std/optional (nullopt): Likewise.
	* include/std/ratio (ratio_equal_v, ratio_not_equal_v, ratio_less_v)
	ratio_less_equal_v, ratio_greater_v, ratio_greater_equal_v): Likewise.
	* include/std/system_error (is_error_code_enum_v)
	(is_error_condition_enum_v): Likewise.
	* include/std/tuple (tuple_size_v, ignore): Likewise.
	(ignore): Declare ignore constexpr as per LWG 2773, declare assignment
	constexpr as per LWG 2933.
	* include/std/type_traits (All variable templates): Add
	_GLIBCXX17_INLINE as per P0607R0.
	* include/std/variant (variant_size_v, variant_npos, __index_of_v)
	(__tuple_count_v, __exactly_once): Likewise.
	* testsuite/18_support/headers/new/synopsis.cc
	(hardware_destructive_interference_size)
	(hardware_constructive_interference_size): Likewise for commented-out
	variables.
	* testsuite/20_util/tuple/creation_functions/constexpr.cc: Add new
	test function for constexpr std::ignore (LWG 2773).
	* testsuite/20_util/tuple/creation_functions/constexpr_cpp14.cc: New
	test for LWG 2933.

From-SVN: r246423
2017-03-23 19:40:07 +00:00
Jonathan Wakely af181c91a9 Add deduction guides for C++17 (P0433R2, partial)
* include/bits/shared_ptr.h (shared_ptr, weak_ptr): Add deduction
	guides for C++17.
	* include/bits/std_function.h (function): Likewise.
	* include/bits/stl_pair.h (pair): Likewise.
	* include/debug/array (__gnu_debug::array): Likewise.
	* include/std/array (array): Likewise.
	* include/std/functional (make_default_searcher)
	(make_boyer_moore_searcher, make_boyer_moore_horspool_searcher):
	Remove generator functions.
	* include/std/tuple (tuple): Add deduction guides.
	* include/std/valarray (valarray): Likewise.
	* testsuite/20_util/function_objects/searchers.cc: Adjust to use
	class template argument deduction instead of generator functions.
	* testsuite/20_util/function/cons/deduction.cc: New test.
	* testsuite/20_util/optional/cons/deduction_guide.cc: Rename to ...
	* testsuite/20_util/optional/cons/deduction.cc: ... here.
	* testsuite/20_util/pair/cons/deduction.cc: New test.
	* testsuite/20_util/shared_ptr/cons/deduction.cc: New test.
	* testsuite/20_util/tuple/cons/deduction.cc: New test.
	* testsuite/20_util/tuple/element_access/get_neg.cc: Adjust dg-error.
	* testsuite/20_util/unique_ptr/cons/deduction_neg.cc: New test.
	* testsuite/20_util/weak_ptr/cons/deduction.cc: New test.
	* testsuite/23_containers/array/cons/deduction.cc: New test.
	* testsuite/23_containers/array/cons/deduction_neg.cc: New test.
	* testsuite/23_containers/array/tuple_interface/get_debug_neg.cc:
	Adjust dg-error.
	* testsuite/23_containers/array/tuple_interface/get_neg.cc: Likewise.
	* testsuite/23_containers/array/tuple_interface/tuple_element_neg.cc:
	Likewise.
	* testsuite/26_numerics/valarray/deduction.cc: New test.
	* testsuite/30_threads/lock_guard/cons/deduction.cc: New test.
	* testsuite/30_threads/scoped_lock/cons/deduction.cc: New test.
	* testsuite/30_threads/unique_lock/cons/deduction.cc: New test.

From-SVN: r246389
2017-03-22 15:58:35 +00:00
Jonathan Wakely d951e75dfe Fix alignment bugs in std::codecvt_utf16
* src/c++11/codecvt.cc (range): Add non-type template parameter and
	define oerloaded operators for reading and writing code units.
	(range<Elem, false>): Define partial specialization for accessing
	wide characters in potentially unaligned byte ranges.
	(ucs2_span(const char16_t*, const char16_t*, ...))
	(ucs4_span(const char16_t*, const char16_t*, ...)): Change parameters
	to range<const char16_t, false> in order to avoid unaligned reads.
	(__codecvt_utf16_base<char16_t>::do_out)
	(__codecvt_utf16_base<char32_t>::do_out)
	(__codecvt_utf16_base<wchar_t>::do_out): Use range specialization for
	unaligned data to avoid unaligned writes.
	(__codecvt_utf16_base<char16_t>::do_in)
	(__codecvt_utf16_base<char32_t>::do_in)
	(__codecvt_utf16_base<wchar_t>::do_in): Likewise for writes. Return
	error if there are unprocessable trailing bytes.
	(__codecvt_utf16_base<char16_t>::do_length)
	(__codecvt_utf16_base<char32_t>::do_length)
	(__codecvt_utf16_base<wchar_t>::do_length): Pass arguments of type
	range<const char16_t, false> to span functions.
	* testsuite/22_locale/codecvt/codecvt_utf16/misaligned.cc: New test.

From-SVN: r246245
2017-03-17 19:28:05 +00:00
Jonathan Wakely a4c687d64b PR libstdc++/80041 fix codecvt_utf16<wchar_t> to use UTF-16 not UTF-8
PR libstdc++/80041
	* src/c++11/codecvt.cc (__codecvt_utf16_base<wchar_t>::do_out)
	(__codecvt_utf16_base<wchar_t>::do_in): Convert char arguments to
	char16_t to work with UTF-16 instead of UTF-8.
	* testsuite/22_locale/codecvt/codecvt_utf16/80041.cc: New test.

From-SVN: r246202
2017-03-16 15:28:02 +00:00
Jonathan Wakely 516231de73 Fix encoding() and max_length() values for codecvt facets
* src/c++11/codecvt.cc (codecvt<char16_t, char, mbstate_t>)
	(codecvt<char32_t, char, mbstate_t>, __codecvt_utf8_base<char16_t>)
	(__codecvt_utf8_base<char32_t>, __codecvt_utf8_base<wchar_t>)
	(__codecvt_utf16_base<char16_t>, __codecvt_utf16_base<char32_t>)
	(__codecvt_utf16_base<wchar_t>, __codecvt_utf8_utf16_base<char16_t>)
	(__codecvt_utf8_utf16_base<char32_t>)
	(__codecvt_utf8_utf16_base<wchar_t>): Fix do_encoding() and
	do_max_length() return values.
	* testsuite/22_locale/codecvt/codecvt_utf16/members.cc: New test.
	* testsuite/22_locale/codecvt/codecvt_utf8/members.cc: New test.
	* testsuite/22_locale/codecvt/codecvt_utf8_utf16/members.cc: New test.

From-SVN: r246201
2017-03-16 15:27:57 +00:00
Jonathan Wakely bcd682e1fa PR libstdc++/79980 fix BOM detection, maxcode checks, UCS2 handling
PR libstdc++/79980
	* include/bits/locale_conv.h (__do_str_codecvt): Set __count on
	error path.
	* src/c++11/codecvt.cc (operator&=, operator|=, operator~): Overloads
	for manipulating codecvt_mode values.
	(read_utf16_bom): Compare input to BOM constants instead of integral
	constants that depend on endianness.  Take mode parameter by
	reference and adjust it, to distinguish between no BOM present and
	UTF-16BE BOM present.
	(ucs4_in, ucs2_span, ucs4_span): Adjust calls to read_utf16_bom.
	(surrogates): New enumeration type.
	(utf16_in, utf16_out): Add surrogates parameter to choose between
	UTF-16 and UCS2 behaviour.
	(utf16_span, ucs2_span): Use std::min not std::max.
	(ucs2_out): Use std::min not std::max.  Disallow surrogate pairs.
	(ucs2_in): Likewise. Adjust calls to read_utf16_bom.
	* testsuite/22_locale/codecvt/codecvt_utf16/79980.cc: New test.
	* testsuite/22_locale/codecvt/codecvt_utf8/79980.cc: New test.

From-SVN: r246200
2017-03-16 15:27:51 +00:00
Jonathan Wakely 02e12bda2d PR libstdc++/79511 fix endianness of UTF-16 data
PR libstdc++/79511
	* src/c++11/codecvt.cc (write_utf16_code_point): Don't write 0xffff
	as a surrogate pair.
	(__codecvt_utf8_utf16_base<char32_t>::do_in): Use native endianness
	for internal representation.
	(__codecvt_utf8_utf16_base<wchar_t>::do_in): Likewise.
	* testsuite/22_locale/codecvt/codecvt_utf8_utf16/79511.cc: New test.

From-SVN: r246199
2017-03-16 15:27:45 +00:00
Jonathan Wakely 8d85abab44 PR libstdc++/80064 make heap algorithms work with function types
PR libstdc++/80064
	* include/bits/stl_heap.h (__is_heap, push_heap, __adjust_heap)
	(pop_heap, make_heap, sort_heap, is_heap_until, is_heap): Cope with
	invalid instantiations using function types for _Compare argument.
	* testsuite/25_algorithms/make_heap/80064.cc: New test.

From-SVN: r246197
2017-03-16 14:32:07 +00:00
Ville Voutilainen df99018275 Implement LWG 2857, {variant,optional,any}::emplace should return the constructed value.
Implement LWG 2857, {variant,optional,any}::emplace should
return the constructed value.
* include/std/any (emplace(_Args&&...)): Change the return type and
return a reference to the constructed value.
(emplace(initializer_list<_Up>, _Args&&...)): Likewise.
* include/std/optional (emplace(_Args&&...)): Likewise.
(emplace(initializer_list<_Up>, _Args&&...)): Likewise.
* include/std/variant (emplace<_Tp>(_Args&&...)): Likewise.
(emplace<_Tp>(initializer_list<_Up>, _Args&&...)): Likewise.
(emplace<_Np>(_Args&&...)): Likewise.
(emplace<_Np>(initializer_list<_Up>, _Args&&...)): Likewise.
* testsuite/20_util/any/assign/emplace.cc: Add tests for
checking the return value of emplace.
* testsuite/20_util/any/misc/any_cast_neg.cc: Adjust.
* testsuite/20_util/optional/assignment/6.cc: Add tests for
checking the return value of emplace.
* testsuite/20_util/variant/run.cc: Likewise.

From-SVN: r246182
2017-03-16 01:13:20 +02:00
Jonathan Wakely 75d359f759 PR libstdc++/62045 fix O(N) insertion in pd_ds binary heap
2017-03-15  Xi Ruoyao  <ryxi@stu.xidian.edu.cn>

	PR libstdc++/62045
	* include/ext/pb_ds/qdetail/binary_heap_/binary_heap_.hpp
	(is_heap): Remove.
	(push_heap): Remove the wrong checking using is_heap.
	(make_heap): Remove the assertion using is_heap.
	* include/ext/pb_ds/detail/binary_heap_/insert_fn_imps.hpp
	(modify): Ditto.
	(resize_for_insert_if_needed): Add PB_DS_ASSERT_VALID after
	calling make_heap.

2017-03-15  Jonathan Wakely  <jwakely@redhat.com>

	PR libstdc++/62045
	* testsuite/ext/pb_ds/regression/priority_queue_binary_heap-62045.cc:
	New test.
	* testsuite/ext/pb_ds/regression/priority_queues.cc: Fix copy&paste
	error in comment.

From-SVN: r246173
2017-03-15 20:11:48 +00:00
Jonathan Wakely 4f83482f46 PR libstdc++/79162 disambiguate assignment from string_view
PR libstdc++/79162
	* include/bits/basic_string.h [_GLIBCXX_USE_CXX11_ABI]
	(basic_string<C,T,A>::operator=(basic_string_view<C,T>)): Replace
	with a constrained template.
	[!_GLIBCXX_USE_CXX11_ABI]
	(basic_string<C,T,A>::operator=(basic_string_view<C,T>)): Likewise.
	* testsuite/21_strings/basic_string/cons/char/79162.cc: New test.
	* testsuite/21_strings/basic_string/cons/wchar_t/79162.cc: New test.

From-SVN: r246128
2017-03-14 14:51:19 +00:00
Ville Voutilainen 648c989484 re PR libstdc++/80034 (unqualified calls to std::distance in std::list::sort)
PR libstdc++/80034
* include/bits/list.tcc (merge(list&&)): Use const for the size_t
in the catch-block.
(merge(list&&, _StrictWeakOrdering)): Likewise.
* testsuite/23_containers/list/operations/80034.cc: New.

From-SVN: r246107
2017-03-13 21:41:50 +02:00
Ville Voutilainen fd231ad75a Implement LWG 2806, Base class of bad_optional_access.
* include/std/optional (bad_optional_access):
Derive from std::exception.
(bad_optional_access::bad_optional_access): Adjust.
(bad_optional_access::what): New.
(__throw_bad_optional_access(const char*)):
Remove the parameter and adjust calls.
* testsuite/20_util/optional/cons/value_neg.cc: Adjust.
* testsuite/20_util/optional/typedefs.cc: Likewise.

From-SVN: r246103
2017-03-13 20:03:30 +02:00
Ville Voutilainen 06272afbd3 Implement LWG 2934, optional<const T> doesn't compare with T.
* include/std/optional
(operator==(const optional<_Tp>&, const optional<_Tp>&)):
Turn into operator==(const optional<_Tp>&, const optional<_Up>&).
(operator!=(const optional<_Tp>&, const optional<_Tp>&)):
Turn into operator!=(const optional<_Tp>&, const optional<_Up>&).
(operator<(const optional<_Tp>&, const optional<_Tp>&)):
Turn into operator<(const optional<_Tp>&, const optional<_Up>&.
(operator>(const optional<_Tp>&, const optional<_Tp>&)):
Turn into operator>(const optional<_Tp>&, const optional<_Up>&.
(operator<=(const optional<_Tp>&, const optional<_Tp>&)):
Turn into operator<=(const optional<_Tp>&, const optional<_Up>&).
(operator>=(const optional<_Tp>&, const optional<_Tp>&)):
Turn into operator>=(const optional<_Tp>&, const optional<_Up>&).
(operator==(const optional<_Tp>&, const _Tp&)):
Turn into operator==(const optional<_Tp>&, const _Up&).
(operator==(const _Tp&, const optional<_Tp>&)):
Turn into operator==(const _Up&, const optional<_Tp>&).
(operator!=(const optional<_Tp>&, const _Tp&)):
Turn into operator!=(const optional<_Tp>&, const _Up&).
(operator!=(const _Tp&, const optional<_Tp>&)):
Turn into operator!=(const _Up&, const optional<_Tp>&).
(operator<(const optional<_Tp>&, const _Tp&)):
Turn into operator<(const optional<_Tp>&, const _Up&).
(operator<(const _Tp&, const optional<_Tp>&)):
Turn into operator<(const _Up&, const optional<_Tp>&).
(operator>(const optional<_Tp>&, const _Tp&)):
Turn into operator>(const optional<_Tp>&, const _Up&).
(operator>(const _Tp&, const optional<_Tp>&)):
Turn into operator>(const _Up&, const optional<_Tp>&).
(operator<=(const optional<_Tp>&, const _Tp&)):
Turn into operator<=(const optional<_Tp>&, const _Up&).
(operator<=(const _Tp&, const optional<_Tp>&)):
Turn into operator<=(const _Up&, const optional<_Tp>&).
(operator>=(const optional<_Tp>&, const _Tp&)):
Turn into operator>=(const optional<_Tp>&, const _Up&).
(operator>=(const _Tp&, const optional<_Tp>&)):
Turn into operator>=(const _Up&, const optional<_Tp>&).
* testsuite/20_util/optional/relops/7.cc: New.

From-SVN: r246076
2017-03-12 12:32:31 +02:00
Jonathan Wakely da0ced6eb8 Fix libstdc++ reserved names test to pass on AIX
* testsuite/17_intro/names.cc: Undefine macros that clash with
	identifiers in AIX system headers.

From-SVN: r246037
2017-03-10 15:29:49 +00:00
Jonathan Wakely 7dcc645ccd P0604R0 add invoke_result, is_invocable etc. for C++17
* include/bits/invoke.h (__invoke): Use __invoke_result instead of
	result_of, and __is_nothrow_invocable instead of
	__is_nothrow_callable.
	* include/bits/shared_ptr_base.h (__shared_ptr): Use __is_invocable
	instead of __is_callable.
	* include/std/functional (invoke): use invoke_result_t instead of
	result_of_t and is_nothrow_invocable instead of is_nothrow_callable.
	(_Not_fn): Use __invoke_result instead of result_of.
	* include/std/type_traits (__result_of_memobj, __result_of_memfun):
	Remove partial specializations for reference_wrapper types.
	(__result_of_impl): Use __inv_unwrap to strip reference_wrapper.
	(__invoke_result): Define replacement for result_of and then use it to
	define result_of.
	(__is_callable_impl, __is_callable, __is_nothrow_callable): Replace
	with __is_invocable_impl, __is_invocable, and __is_nothrow_invocable
	respectively.
	(invoke_result, invoke_result_t): Define for C++17.
	(is_callable, is_nothrow_callable): Replace with is_invocable,
	is_invocable_r, is_nothrow_invocable, and is_nothrow_invocable_r.
	(is_callable_v, is_nothrow_callable_v): Replace with is_invocable_v,
	is_invocable_r_v, is_nothrow_invocable_v, and is_nothrow_invocable_r_v.
	* include/std/variant (hash<variant<T...>>): Use is_nothrow_invocable_v
	instead of is_nothrow_callable_v.
	* testsuite/20_util/function_objects/invoke/59768.cc: Remove unused
	main function.
	* testsuite/20_util/function_objects/not_fn/1.cc: Use is_invocable
	instead of is_callable.
	* testsuite/20_util/is_callable/*: Rename directory and adjust tests
	to use new traits.
	* testsuite/20_util/is_notjrow_callable/*: Likewise.
	* testsuite/20_util/optional/hash.cc: Use is_invocable_v instead of
	is_callable.
	* testsuite/20_util/variant/hash.cc: Likewise.

From-SVN: r246036
2017-03-10 15:29:38 +00:00
Jonathan Wakely e0472d7e8c Define std::byte for C++17 (P0298R3)
* doc/xml/manual/status_cxx2017.xml: Document std::byte support.
	* include/c_global/cstddef (std::byte): Define for C++17.
	* testsuite/18_support/byte/global_neg.cc: New test.
	* testsuite/18_support/byte/ops.cc: New test.
	* testsuite/18_support/byte/requirements.cc: New test.

From-SVN: r246005
2017-03-09 15:42:02 +00:00
Jonathan Wakely f620e1d5c8 Add std::scoped_lock for C++17
* doc/xml/manual/status_cxx2017.xml: Document P0156R2 status.
	* doc/html/*: Regenerate.
	* include/std/mutex (scoped_lock): Implement new C++17 template.
	* testsuite/30_threads/scoped_lock/cons/1.cc: New test.
	* testsuite/30_threads/scoped_lock/requirements/
	explicit_instantiation.cc: New test.
	* testsuite/30_threads/scoped_lock/requirements/typedefs.cc: New test.

From-SVN: r245903
2017-03-05 18:38:35 +00:00
Jonathan Wakely 17b0b37f58 Rename 17_intro/headers/names.cc test file
* testsuite/17_intro/headers/names.cc: Rename to ...
	* testsuite/17_intro/names.cc: ... here.

From-SVN: r245845
2017-03-02 18:56:57 +00:00
Jonathan Wakely d34d36ef0d PR libstdc++/79789 fix non-reserved names in headers
PR libstdc++/79789
	* include/bits/hashtable_policy.h (__clp2): Use reserved names for
	parameters and local variables.
	* include/bits/ios_base.h (make_error_code, make_error_condition):
	Likewise.
	* include/bits/list.tcc (list::sort): Likewise.
	* include/bits/mask_array.h (mask_array): Likewise.
	* include/bits/regex.h (regex_token_iterator): Likewise.
	* include/bits/slice_array.h (slice_array): Likewise.
	* include/bits/stl_algo.h (__sample): Likewise.
	* include/std/memory (undeclare_no_pointers): Likewise.
	* include/std/type_traits (is_callable_v, is_nothrow_callable_v):
	Likewise.
	* libsupc++/exception_ptr.h (__dest_thunk): Likewise.
	* testsuite/17_intro/headers/names.cc: New test.

From-SVN: r245828
2017-03-02 03:43:49 +00:00
Jonathan Wakely 5782e30941 PR 79798 Fix incorrect use of std::result_of in std::bind
PR libstdc++/79798
	* include/std/functional (bind::_Res_type_impl): Fix incorrect use of
	result_of that loses top-level cv-qualifiers.
	* testsuite/20_util/bind/79798.cc: New test.

From-SVN: r245827
2017-03-02 03:43:36 +00: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
Dinka Ranns 1dee318ad8 C++17 GB50 resolution (P0505R0)
2017-02-19  Dinka Ranns  <dinka.ranns@googlemail.com>

	C++17 GB50 resolution
	* include/std/chrono (duration::operator++()): Add
	_GLIBCXX17_CONSTEXPR.
	(duration::operator++(int)): Likewise.
	(duration::operator--()): Likewise.
	(duration::operator--(int)): Likewise.
	(duration::operator+=(const duration&)): Likewise.
	(duration::operator-=(const duration&)): Likewise.
	(duration::operator*=(const rep&)): Likewise.
	(duration::operator/=(const rep&)): Likewise.
	(duration::operator%=(const rep&)): Likewise.
	(duration::operator%=(const duration&)): Likewise.
	(time_point::operator+=(const duration&)): Likewise.
	(time_point::operator-=(const duration&)): Likewise.
	* testsuite/20_util/duration/arithmetic/constexpr_c++17.cc: New test.
	* testsuite/20_util/duration/literals/range.cc: Adjust dg-error.
	* testsuite/20_util/time_point/arithmetic/constexpr.cc: New test.

From-SVN: r245575
2017-02-19 16:04:35 +00:00
Tim Shen d255829bbc re PR libstdc++/78723 ([variant] P0393r3: "Making variant greater equal again" is unimplemented)
PR libstdc++/78723
	* include/std/variant (operator<(), operator>(), operator<=(),
	operator>=(), operator==(), operator!=()): Implement P0393R3.
	* testsuite/20_util/variant/compile.cc: Adjust tests.
	* testsuite/20_util/variant/run.cc: Adjust tests.

From-SVN: r245475
2017-02-15 09:01:06 +00:00
Tim Shen 7d5abe42c2 re PR libstdc++/79513 (std::visit doesn't handle references)
PR libstdc++/79513
	* include/std/variant (visit()): Forward variant types to the return
	type detection code.
	* testsuite/20_util/variant/compile.cc: Add test cases.

From-SVN: r245474
2017-02-15 07:38:20 +00:00
Jonathan Wakely def227f1ad PR libstdc++/79486 use lvalues in result_of expressions
PR libstdc++/79486
	* include/std/future (__future_base::_Task_state::_M_run)
	(__future_base::_Task_state::_M_run_delayed): Use lvalue types in
	result_of expressions.
	* testsuite/30_threads/packaged_task/79486.cc: New.

From-SVN: r245386
2017-02-13 13:13:29 +00:00
Jonathan Wakely 99ebfe9075 PR libstdc++/79467 use lvalues in is_callable check
PR libstdc++/79467
	* include/bits/shared_ptr_base.h (__shared_ptr(_Yp*, _Deleter))
	(__shared_ptr(_Yp*, _Deleter, _Alloc)): Use lvalue types in
	__is_callable check.
	* testsuite/20_util/shared_ptr/cons/79467.cc: New.

From-SVN: r245363
2017-02-11 21:08:11 +00:00
Jonathan Wakely 3e4fd831e9 Fix test failure at -O0 by pruning output
PR libstdc++/79323
	* testsuite/20_util/duration/literals/range.cc: Prune extra output
	at -O0.

From-SVN: r245211
2017-02-06 16:39:56 +00:00
Jonathan Wakely 10613537a9 PR libstdc++/66145 ensure new ABI for ios::failure tests
PR libstdc++/66145
	* testsuite/27_io/basic_ios/copyfmt/char/1.cc: Restore ABI override
	so new ios::failure can be caught even when old ABI is the default.
	* testsuite/27_io/basic_ios/exceptions/char/1.cc: Likewise.
	* testsuite/27_io/basic_istream/extractors_arithmetic/char/
	exceptions_failbit.cc: Likewise.
	* testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/
	exceptions_failbit.cc: Likewise.
	* testsuite/27_io/basic_istream/extractors_other/char/
	exceptions_null.cc: Likewise.
	* testsuite/27_io/basic_istream/extractors_other/wchar_t/
	exceptions_null.cc: Likewise.
	* testsuite/27_io/basic_istream/sentry/char/12297.cc: Likewise.
	* testsuite/27_io/basic_istream/sentry/wchar_t/12297.cc: Likewise.
	* testsuite/27_io/basic_ostream/inserters_other/char/
	exceptions_null.cc: Likewise.
	* testsuite/27_io/basic_ostream/inserters_other/wchar_t/
	exceptions_null.cc: Likewise.
	* testsuite/27_io/ios_base/storage/2.cc: Likewise.

From-SVN: r245167
2017-02-03 19:26:51 +00:00
Jonathan Wakely 2cf9276ba7 PR78346 make <bits/predefined_ops.h> handle stashing iterators
PR libstdc++/78346
	* include/bits/predefined_ops.h (_Iter_equals_iter): Store iterator
	not its referent.
	(_Iter_comp_to_iter): Likewise.
	* testsuite/25_algorithms/search/78346.cc: New test.

From-SVN: r245090
2017-02-01 12:57:35 +00:00
Jonathan Wakely 11d10beb57 PR libstdc++/79254 simplify exception-safety in copy assignment
PR libstdc++/79254
	* config/abi/pre/gnu.ver: Remove recently added symbols.
	* include/bits/basic_string.h [_GLIBCXX_USE_CXX11_ABI]
	(basic_string::_M_copy_assign): Remove.
	(basic_string::operator=(const basic_string&)): Don't dispatch to
	_M_copy_assign. If source object is small just deallocate, otherwise
	perform new allocation before making any changes.
	* include/bits/basic_string.tcc [_GLIBCXX_USE_CXX11_ABI]
	(basic_string::_M_copy_assign(const basic_string&, true_type)):
	Remove.
	* testsuite/21_strings/basic_string/allocator/char/copy_assign.cc:
	Test cases where the allocators are equal or the string is small.
	* testsuite/21_strings/basic_string/allocator/wchar_t/copy_assign.cc:
	Likewise.

From-SVN: r245085
2017-02-01 11:41:48 +00:00
Ville Voutilainen 1dd9523917 Implement LWG 2825, LWG 2756 breaks class template argument deduction for optional.
* include/std/optional: Add a deduction guide.
* testsuite/20_util/optional/cons/deduction_guide.cc: New.

From-SVN: r245024
2017-01-30 15:37:16 +02:00
Jonathan Wakely a7d47f3526 PR libstdc++/79254 fix exception-safety in std::string::operator=
PR libstdc++/79254
	* config/abi/pre/gnu.ver: Add new symbols.
	* include/bits/basic_string.h [_GLIBCXX_USE_CXX11_ABI]
	(basic_string::_M_copy_assign): New overloaded functions to perform
	copy assignment.
	(basic_string::operator=(const basic_string&)): Dispatch to
	_M_copy_assign.
	* include/bits/basic_string.tcc [_GLIBCXX_USE_CXX11_ABI]
	(basic_string::_M_copy_assign(const basic_string&, true_type)):
	Define, performing rollback on exception.
	* testsuite/21_strings/basic_string/allocator/char/copy_assign.cc:
	Test exception-safety guarantee.
	* testsuite/21_strings/basic_string/allocator/wchar_t/copy_assign.cc:
	Likewise.
	* testsuite/util/testsuite_allocator.h (uneq_allocator::swap): Make
	std::swap visible.

From-SVN: r244986
2017-01-27 16:17:04 +00:00
Jonathan Wakely 881191e865 Fix libstdc++ testsuite failures in C++98 and C++11 mode
* testsuite/23_containers/list/operations/78389.cc: Fix for C++11
	mode.
	* testsuite/23_containers/priority_queue/requirements/constructible.cc:
	Mark as unsupported in C++98 mode.
	* testsuite/23_containers/queue/requirements/constructible.cc:
	Likewise.
	* testsuite/23_containers/stack/requirements/constructible.cc:
	Likewise.
	* testsuite/25_algorithms/make_heap/movable.cc: Fix for C++11 mode.

From-SVN: r244950
2017-01-26 19:39:53 +00:00
Jakub Jelinek 68edb9bafe update-copyright.py: Add libhsail-rt to self.default_dirs and call self.add_dir on it.
contrib/
	* update-copyright.py: Add libhsail-rt to self.default_dirs
	and call self.add_dir on it.  Add Intel Corporation to external
	authors.
gcc/
	* brig-builtins.def: Update copyright years.
	* config/arm/arm_acle_builtins.def: Update copyright years.
gcc/brig/
	Update copyright years.
gcc/testsuite/
	* brig.dg/dg.exp: Update copyright years.
	* lib/brig-dg.exp: Update copyright years.
	* lib/brig.exp: Update copyright years.
libhsail-rt/
	Update copyright years.
libstdc++-v3/
	* libsupc++/eh_atomics.h: Update copyright years.
	* testsuite/20_util/unique_ptr/cons/default.cc: Update copyright years.

From-SVN: r244919
2017-01-26 09:24:22 +01:00
Jonathan Wakely 536c221d20 PR libstdc++/70607 make proj(T) and conj(T) return complex<T>
PR libstdc++/61791
	PR libstdc++/70607
	* include/std/complex (real(T), imag(T)): Add _GLIBCXX_CONSTEXPR.
	(proj(T), conj(T)): Change return types per DR 1522.
	* include/tr1/complex (conj): Remove overloads and use std::conj.
	* testsuite/26_numerics/complex/dr781_dr1137.cc: Rename to...
	* testsuite/26_numerics/complex/dr781.cc: ... this, and update.
	* testsuite/26_numerics/complex/value_operations/constexpr2.cc: Test
	real(T) and imag(T). Allow testing for C++11 too.

From-SVN: r244900
2017-01-25 15:01:05 +00:00
Jonathan Wakely 11948d8394 Restore <functional> header to test
* testsuite/experimental/array/make_array.cc: Restore <functional>
	inclusion.

From-SVN: r244840
2017-01-23 23:59:08 +00:00
Thomas Preud'homme a750159e3b 69301.cc: Require atomic builtins.
2017-01-23  Thomas Preud'homme  <thomas.preudhomme@arm.com>

    libstdc++-v3/
    * testsuite/29_atomics/atomic/69301.cc: Require atomic builtins.

From-SVN: r244819
2017-01-23 17:18:04 +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
Ville Voutilainen 509912a611 Make poisoned hashes SFINAE away the call operator of the hash.
* include/bits/functional_hash.h
(__poison_hash::__enable_hash_call): New.
* include/std/optional (__optional_hash_call_base): New.
(hash<optional<_Tp>>): Derive from the new base,
move the hash function into that base.
* include/std/variant (__variant_hash_call_base_impl): New.
(__variant_hash_call_base): Likewise.
(hash<variant<_Types...>>): Derive from the new base,
move the hash function into that base.
* testsuite/20_util/optional/hash.cc: Add tests for is_callable.
* testsuite/20_util/variant/hash.cc: Likewise.

From-SVN: r244748
2017-01-21 17:38:23 +02:00
Jonathan Wakely 12905f106c PR69240 Define inequality operators for <random> param types
PR libstdc++/69240
	* include/bits/random.h (uniform_real_distribution::param_type)
	(normal_distribution::param_type, lognormal_distribution::param_type)
	(gamma_distribution::param_type, chi_squared_distribution::param_type)
	(cauchy_distribution::param_type, fisher_f_distribution::param_type)
	(student_t_distribution::param_type)
	(bernoulli_distribution::param_type, binomial_distribution::param_type)
	(geometric_distribution::param_type)
	(negative_binomial_distribution::param_type)
	(poisson_distribution::param_type)
	(exponential_distribution::param_type)
	(weibull_distribution::param_type)
	(extreme_value_distribution::param_type)
	(discrete_distribution::param_type)
	(piecewise_constant_distribution::param_type)
	(piecewise_linear_distribution::param_type): Define operator!=.
	* include/bits/uniform_int_dist.h
	(uniform_int_distribution::param_type): Likewise.
	* include/ext/random (beta_distribution::param_type)
	(rice_distribution::param_type, nakagami_distribution::param_type)
	(pareto_distribution::param_type, k_distribution::param_type)
	(arcsine_distribution::param_type, hoyt_distribution::param_type)
	(triangular_distribution::param_type)
	(von_mises_distribution::param_type)
	(hypergeometric_distribution::param_type)
	(logistic_distribution::param_type)
	(uniform_on_sphere_distribution::param_type)
	(uniform_inside_sphere_distribution::param_type): Likewise.
	* testsuite/26_numerics/random/bernoulli_distribution/cons/parms.cc:
	Test construction with param_type.
	* testsuite/26_numerics/random/binomial_distribution/cons/parms.cc:
	Likewise.
	* testsuite/26_numerics/random/cauchy_distribution/cons/parms.cc:
	Likewise.
	* testsuite/26_numerics/random/chi_squared_distribution/cons/parms.cc:
	Likewise.
	* testsuite/26_numerics/random/exponential_distribution/cons/parms.cc:
	Likewise.
	* testsuite/26_numerics/random/extreme_value_distribution/cons/
	parms.cc: Likewise.
	* testsuite/26_numerics/random/fisher_f_distribution/cons/parms.cc:
	Likewise.
	* testsuite/26_numerics/random/gamma_distribution/cons/parms.cc:
	Likewise.
	* testsuite/26_numerics/random/geometric_distribution/cons/parms.cc:
	Likewise.
	* testsuite/26_numerics/random/lognormal_distribution/cons/parms.cc:
	Likewise.
	* testsuite/26_numerics/random/negative_binomial_distribution/cons/
	parms.cc: Likewise.
	* testsuite/26_numerics/random/normal_distribution/cons/parms.cc:
	Likewise.
	* testsuite/26_numerics/random/poisson_distribution/cons/parms.cc:
	Likewise.
	* testsuite/26_numerics/random/student_t_distribution/cons/parms.cc:
	Likewise.
	* testsuite/26_numerics/random/uniform_int_distribution/cons/parms.cc:
	Likewise.
	* testsuite/26_numerics/random/uniform_real_distribution/cons/parms.cc:
	Likewise.
	* testsuite/26_numerics/random/weibull_distribution/cons/parms.cc:
	Likewise.
	* testsuite/ext/random/arcsine_distribution/cons/parms.cc: Likewise.
	* testsuite/ext/random/beta_distribution/cons/parms.cc: Likewise.
	* testsuite/ext/random/hoyt_distribution/cons/parms.cc: Likewise.
	* testsuite/ext/random/hypergeometric_distribution/cons/parms.cc:
	Likewise.
	* testsuite/ext/random/k_distribution/cons/parms.cc: Likewise.
	* testsuite/ext/random/logistic_distribution/cons/parms.cc: Likewise.
	* testsuite/ext/random/nakagami_distribution/cons/parms.cc: Likewise.
	* testsuite/ext/random/normal_mv_distribution/cons/parms.cc: Likewise.
	* testsuite/ext/random/pareto_distribution/cons/parms.cc: Likewise.
	* testsuite/ext/random/rice_distribution/cons/parms.cc: Likewise.
	* testsuite/ext/random/triangular_distribution/cons/parms.cc:
	Likewise.
	* testsuite/ext/random/uniform_inside_sphere_distribution/cons/
	parms.cc: Likewise.
	* testsuite/ext/random/von_mises_distribution/cons/parms.cc: Likewise.

From-SVN: r244722
2017-01-20 15:28:48 +00:00
Jonathan Wakely 4dfdda108f PR72792 detect allocator pointer types without invalid rebinding
PR libstdc++/72792
	* include/bits/alloc_traits.h (__allocator_traits_base::__diff_type)
	(__allocator_traits_base::__size_type): Remove.
	(allocator_traits::_Ptr): New class template to detect const and void
	pointer types without instantiating pointer_traits::rebind
	unnecessarily.
	(allocator_traits::_Diff): Likewise for detecting difference_type.
	(allocator_traits::_Size): New class template to detect size_type
	without instantiating make_unsigned unnecessarily.
	* include/bits/ptr_traits.h (pointer_traits::element_type): Use
	__detected_or_t instead of __detected_or_t_.
	* include/std/type_traits (__detected_or_t_): Remove.
	* testsuite/20_util/allocator_traits/members/pointers.cc: New test.

From-SVN: r244706
2017-01-20 12:03:36 +00:00
Jonathan Wakely a3a1620bb8 PR72792 PR72793 relax requirements on rebind members
PR libstdc++/72792
	PR libstdc++/72793
	* include/bits/alloc_traits.h (__allocator_traits_base::__rebind):
	Replace with class template using void_t.
	(__alloc_rebind): Define in terms of
	__allocator_traits_base::__rebind.
	(allocator_traits): Remove unconditional static_assert for
	rebind_alloc.
	* include/bits/ptr_traits.h (__replace_first_arg): Remove type member.
	(pointer_traits::__rebind): Replace with class template using void_t.
	(pointer_traits::rebind): Define in terms of __rebind.
	(pointer_traits): Remove unconditional static_assert for rebind.
	* testsuite/20_util/allocator_traits/members/rebind_alloc.cc: New test.
	* testsuite/20_util/pointer_traits/rebind.cc: New test.

From-SVN: r244680
2017-01-20 02:36:16 +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 115ac9ff61 PR79156 fix std::__enable_shared_from_this extension
PR libstdc++/79156
	* include/bits/shared_ptr_base.h (__enable_shared_from_this_base):
	Fix return type.
	(__enable_shared_from_this): Declare __shared_ptr as a friend.
	* testsuite/ext/shared_ptr/1.cc: New test.

From-SVN: r244668
2017-01-20 00:07:14 +00:00
Jonathan Wakely c4e5baa663 PR64903 fix number of predicate tests in std::is_partitioned
PR libstdc++/64903
	* include/bits/stl_algo.h (is_partioned): Don't retest the partition
	point.
	* testsuite/25_algorithms/is_partitioned/2.cc: New test.

From-SVN: r244661
2017-01-19 23:30:18 +00:00
Jonathan Wakely 437f43cc78 PR67085 pass comparison functions by reference in heap algorithms
PR libstdc++/67085
	* include/bits/predefined_ops.h (_Iter_less_val, _Val_less_iter): Add
	converting constructors from _Iter_less_iter.
	(_Iter_comp_val, _Val_comp_iter): Add converting constructors from
	_Iter_comp_iter.
	(__iter_comp_val(_Iter_comp_iter<C>): Use converting constructor.
	(__val_comp_iter(_Iter_comp_iter<C>): Likewise.
	* include/bits/stl_heap.h (__is_heap_until, __push_heap, __pop_heap)
	(__make_heap, __sort_heap): Change _Compare parameters to references.
	(__is_heap, push_heap, __adjust_heap, __pop_heap, pop_heap)
	(__make_heap, make_heap, sort_heap, is_heap_until): Pass comparison
	functions as lvalues.
	(is_heap): Call __is_heap_until directly to avoid copying __comp.
	* testsuite/23_containers/priority_queue/67085.cc: Adjust test to
	count copies during construction with empty sequence.

From-SVN: r244656
2017-01-19 23:07:52 +00:00
Jonathan Wakely 9ade9945a0 Fix unsafe moves inside loops
PR libstdc++/67085
	* include/bits/stl_heap.h (__is_heap): Use _GLIBCXX_MOVE.
	(__make_heap, __sort_heap): Don't use _GLIBCXX_MOVE inside loops.
	* testsuite/23_containers/priority_queue/67085.cc: Adjust expected
	number of copies.
	* testsuite/25_algorithms/make_heap/movable.cc: New test.

From-SVN: r244650
2017-01-19 20:29:07 +00:00
Jonathan Wakely 45b48129d5 PR67085 move comparison functions in heap operations
PR libstdc++/67085
	* include/bits/stl_heap.h (push_heap, __adjust_heap, __pop_heap)
	(pop_heap, __make_heap, make_heap, __sort_heap, sort_heap): Use
	_GLIBCXX_MOVE when passing comparison function to other functions.
	(is_heap_until, is_heap): Use std::move when passing comparison
	function.
	* testsuite/23_containers/priority_queue/67085.cc: New test.

From-SVN: r244648
2017-01-19 18:26:41 +00:00
Jonathan Wakely 8c05647c56 PR78905 define _GLIBCXX_RELEASE macro
PR libstdc++/78905
	* doc/xml/manual/abi.xml (abi.versioning.history): Add markup to
	macro names, filenames, and literal values. Document _GLIBCXX_RELEASE.
	Document that the deprecated _GLIBCXX_VERSION macro was removed for
	the 4.0.0 release.
	* doc/html/*: Regenerate.
	* include/Makefile.am (_GLIBCXX_RELEASE): Set value.
	* include/Makefile.in: Regenerate.
	* include/bits/c++config (_GLIBCXX_RELEASE): Add #define.
	* testsuite/ext/profile/mutex_extensions_neg.cc: Use lineno of 0 in
	dg-error.

From-SVN: r244642
2017-01-19 16:40:46 +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 04c872aae4 PR79114 use decayed type in std::throw_with_nested assertion
PR libstdc++/79114
	* libsupc++/nested_exception.h (throw_with_nested): Use decay instead
	of remove_reference.
	* testsuite/18_support/nested_exception/79114.cc: New test.

From-SVN: r244531
2017-01-17 15:26:06 +00:00
Jakub Jelinek 3c36aa6ba2 re PR other/79046 (g++ -print-file-name=plugin uses full version number in path)
PR other/79046
	* configure: Regenerated.
config/
	* acx.m4 (GCC_BASE_VER): New m4 function.
	(ACX_TOOL_DIRS): Require GCC_BASE_VER, for
	--with-gcc-major-version-only use just major number from BASE-VER.
gcc/
	* configure.ac: Add GCC_BASE_VER.
	* Makefile.in (version): Use @get_gcc_base_ver@ instead of cat to get
	version from BASE-VER file.
	(CFLAGS-gcc.o): Add -DBASEVER=$(BASEVER_s).
	(gcc.o): Depend on $(BASEVER).
	* common.opt (dumpfullversion): New option.
	* gcc.c (driver_handle_option): Handle OPT_dumpfullversion.
	* doc/invoke.texi: Document -dumpfullversion.
	* doc/install.texi: Document --with-gcc-major-version-only.
	* configure: Regenerated.
libatomic/
	* configure.ac: Add GCC_BASE_VER.
	* Makefile.am (gcc_version): Use @get_gcc_base_ver@ instead of cat to
	get version from BASE-VER file.
	* testsuite/Makefile.in: Regenerated.
	* configure: Regenerated.
	* Makefile.in: Regenerated.
libgomp/
	* configure.ac: Add GCC_BASE_VER.
	* Makefile.am (gcc_version): Use @get_gcc_base_ver@ instead of cat to
	get version from BASE-VER file.
	* testsuite/Makefile.in: Regenerated.
	* configure: Regenerated.
	* Makefile.in: Regenerated.
libgcc/
	* configure.ac: Add GCC_BASE_VER.
	* Makefile.in (version): Use @get_gcc_base_ver@ instead of cat to get
	version from BASE-VER file.
	* configure: Regenerated.
libssp/
	* configure.ac: Add GCC_BASE_VER.
	* Makefile.am (gcc_version): Use @get_gcc_base_ver@ instead of cat to
	get version from BASE-VER file.
	* configure: Regenerated.
	* Makefile.in: Regenerated.
liboffloadmic/
	* configure.ac: Add GCC_BASE_VER.
	* Makefile.am (gcc_version): Use @get_gcc_base_ver@ instead of cat to
	get version from BASE-VER file.
	* aclocal.m4: Include ../config/acx.m4.
	* configure: Regenerated.
	* Makefile.in: Regenerated.
libquadmath/
	* configure.ac: Add GCC_BASE_VER.
	* Makefile.am (gcc_version): Use @get_gcc_base_ver@ instead of cat to
	get version from BASE-VER file.
	* configure: Regenerated.
	* Makefile.in: Regenerated.
libmpx/
	* configure.ac: Add GCC_BASE_VER.
	* Makefile.am (gcc_version): Use @get_gcc_base_ver@ instead of cat to
	get version from BASE-VER file.
	* configure: Regenerated.
	* Makefile.in: Regenerated.
libada/
	* configure.ac: Add GCC_BASE_VER.
	* Makefile.in (version): Use @get_gcc_base_ver@ instead of cat to get
	version from BASE-VER file.
	* configure: Regenerated.
lto-plugin/
	* configure.ac: Add GCC_BASE_VER.
	* Makefile.am (gcc_version): Use @get_gcc_base_ver@ instead of cat to
	get version from BASE-VER file.
	* configure: Regenerated.
	* Makefile.in: Regenerated.
libitm/
	* configure.ac: Add GCC_BASE_VER.
	* Makefile.am (gcc_version): Use @get_gcc_base_ver@ instead of cat to
	get version from BASE-VER file.
	* testsuite/Makefile.in: Regenerated.
	* configure: Regenerated.
	* Makefile.in: Regenerated.
fixincludes/
	* configure.ac: Add GCC_BASE_VER.
	* Makefile.in (gcc_version): Use @get_gcc_base_ver@ instead of cat to
	get version from BASE-VER file.
	* configure: Regenerated.
libcilkrts/
	* configure.ac: Add GCC_BASE_VER.
	* Makefile.am (gcc_version): Use @get_gcc_base_ver@ instead of cat to
	get version from BASE-VER file.
	* aclocal.m4: Include ../config/acx.m4.
	* configure: Regenerated.
	* Makefile.in: Regenerated.
libcc1/
	* configure.ac: Add GCC_BASE_VER.  For --with-gcc-major-version-only
	use just major number from BASE-VER.
	* configure: Regenerated.
	* Makefile.in: Regenerated.
libobjc/
	* configure.ac: Add GCC_BASE_VER.
	* Makefile.in (gcc_version): Use @get_gcc_base_ver@ instead of cat to
	get version from BASE-VER file.
	* configure: Regenerated.
libstdc++-v3/
	* configure.ac: Add GCC_BASE_VER.
	* fragment.am (gcc_version): Use @get_gcc_base_ver@ instead of cat to
	get version from BASE-VER file.
	* po/Makefile.in: Regenerated.
	* libsupc++/Makefile.in: Regenerated.
	* testsuite/Makefile.in: Regenerated.
	* src/Makefile.in: Regenerated.
	* configure: Regenerated.
	* Makefile.in: Regenerated.
	* include/Makefile.in: Regenerated.
	* doc/Makefile.in: Regenerated.
	* python/Makefile.in: Regenerated.
	* src/c++11/Makefile.in: Regenerated.
	* src/c++98/Makefile.in: Regenerated.
	* src/filesystem/Makefile.in: Regenerated.
libvtv/
	* configure.ac: Add GCC_BASE_VER.
	* Makefile.am (gcc_version): Use @get_gcc_base_ver@ instead of cat to
	get version from BASE-VER file.
	* testsuite/Makefile.in: Regenerated.
	* configure: Regenerated.
	* Makefile.in: Regenerated.
libsanitizer/
	* configure.ac: Add GCC_BASE_VER.
	* Makefile.am (gcc_version): Use @get_gcc_base_ver@ instead of cat to
	get version from BASE-VER file.
	* libbacktrace/Makefile.in: Regenerated.
	* interception/Makefile.in: Regenerated.
	* asan/Makefile.in: Regenerated.
	* ubsan/Makefile.in: Regenerated.
	* configure: Regenerated.
	* sanitizer_common/Makefile.in: Regenerated.
	* lsan/Makefile.in: Regenerated.
	* Makefile.in: Regenerated.
	* tsan/Makefile.in: Regenerated.
libgfortran/
	* configure.ac: Add GCC_BASE_VER.
	* Makefile.am (gcc_version): Use @get_gcc_base_ver@ instead of cat to
	get version from BASE-VER file.
	* configure: Regenerated.
	* Makefile.in: Regenerated.

From-SVN: r244521
2017-01-17 10:38:48 +01:00
Jonathan Wakely 83291b8b8c PR66145 use new ABI for std::ios::failure exceptions
PR libstdc++/66145
	* src/c++11/functexcept.cc: Use new ABI for std::ios_base::failure
	exceptions.
	* testsuite/27_io/basic_ios/copyfmt/char/1.cc: Don't override ABI
	for test, so new ios::failure can be caught.
	* testsuite/27_io/basic_ios/exceptions/char/1.cc: Likewise.
	* testsuite/27_io/basic_istream/extractors_arithmetic/char/
	exceptions_failbit.cc: Likewise.
	* testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/
	exceptions_failbit.cc: Likewise.
	* testsuite/27_io/basic_istream/extractors_other/char/
	exceptions_null.cc: Likewise.
	* testsuite/27_io/basic_istream/extractors_other/wchar_t/
	exceptions_null.cc: Likewise.
	* testsuite/27_io/basic_istream/sentry/char/12297.cc: Likewise.
	* testsuite/27_io/basic_istream/sentry/wchar_t/12297.cc: Likewise.
	* testsuite/27_io/basic_ostream/inserters_other/char/
	exceptions_null.cc: Likewise.
	* testsuite/27_io/basic_ostream/inserters_other/wchar_t/
	exceptions_null.cc: Likewise.
	* testsuite/27_io/ios_base/storage/2.cc: Likewise.

From-SVN: r244498
2017-01-16 15:58:06 +00:00
Ville Voutilainen 53426b63b3 PR libstdc++/78389 fix backwards size adjustments.
PR libstdc++/78389
* include/bits/list.tcc (merge(list&&)): Fix backwards size adjustments.
(merge(list&&, _StrictWeakOrdering)): Likewise.
* testsuite/23_containers/list/operations/78389.cc: Add
better test for the sizes.

From-SVN: r244490
2017-01-16 13:36:33 +02:00
Jonathan Wakely ac4664f9da Skip tests that are incompatible with Profile Mode
* testsuite/23_containers/array/specialized_algorithms/swap_cxx17.cc:
	Skip test when -D_GLIBCXX_PROFILE mode is included in options.
	* testsuite/23_containers/map/modifiers/extract.cc: Likewise.
	* testsuite/23_containers/map/modifiers/insert_or_assign/1.cc:
	Likewise.
	* testsuite/23_containers/map/modifiers/try_emplace/1.cc: Likewise.
	* testsuite/23_containers/multimap/modifiers/extract.cc: Likewise.
	* testsuite/23_containers/multiset/modifiers/extract.cc: Likewise.
	* testsuite/23_containers/set/modifiers/extract.cc: Likewise.
	* testsuite/23_containers/unordered_map/modifiers/extract.cc:
	Likewise.
	* testsuite/23_containers/unordered_multimap/modifiers/extract.cc::
	Likewise.
	* testsuite/23_containers/unordered_multiset/modifiers/extract.cc::
	Likewise.
	* testsuite/23_containers/unordered_set/modifiers/extract.cc:
	Likewise.
	* testsuite/23_containers/vector/modifiers/insert_vs_emplace.cc:
	Likewise.
	* testsuite/25_algorithms/binary_search/partitioned.cc: Likewise.
	* testsuite/25_algorithms/equal_range/partitioned.cc: Likewise.
	* testsuite/25_algorithms/lexicographical_compare/71545.cc: Likewise.
	* testsuite/25_algorithms/lower_bound/partitioned.cc: Likewise.
	* testsuite/25_algorithms/upper_bound/partitioned.cc: Likewise.
	* testsuite/libstdc++-prettyprinters/cxx11.cc: Likewise.
	* testsuite/libstdc++-prettyprinters/cxx17.cc: Likewise.
	* testsuite/libstdc++-prettyprinters/debug.cc: Likewise.
	* testsuite/libstdc++-prettyprinters/debug_cxx11.cc: Likewise.
	* testsuite/libstdc++-prettyprinters/libfundts.cc: Likewise.
	* testsuite/libstdc++-prettyprinters/simple.cc: Likewise.
	* testsuite/libstdc++-prettyprinters/simple11.cc: Likewise.
	* testsuite/libstdc++-prettyprinters/whatis.cc: Likewise.

From-SVN: r244464
2017-01-14 11:55:22 +00:00
Jonathan Wakely 90aa73309e Define cxx11-abi effective target for libstdc++ tests
PR libstdc++/79075
	* testsuite/lib/libstdc++.exp (check_v3_target_filesystem_ts): Remove
	redundant option from cxxflags.
	(check_effective_target_cxx11-abi): Define.
	* testsuite/21_strings/basic_string/allocator/71964.cc: Use cxx11-abi
	effective target.
	* testsuite/21_strings/basic_string/allocator/char/copy.cc: Likewise.
	* testsuite/21_strings/basic_string/allocator/char/copy_assign.cc:
	Likewise.
	* testsuite/21_strings/basic_string/allocator/char/minimal.cc:
	Likewise.
	* testsuite/21_strings/basic_string/allocator/char/move.cc: Likewise.
	* testsuite/21_strings/basic_string/allocator/char/move_assign.cc:
	Likewise.
	* testsuite/21_strings/basic_string/allocator/char/noexcept.cc:
	Likewise.
	* testsuite/21_strings/basic_string/allocator/char/swap.cc: Likewise.
	* testsuite/21_strings/basic_string/allocator/wchar_t/copy.cc:
	Likewise.
	* testsuite/21_strings/basic_string/allocator/wchar_t/copy_assign.cc:
	Likewise.
	* testsuite/21_strings/basic_string/allocator/wchar_t/minimal.cc:
	Likewise.
	* testsuite/21_strings/basic_string/allocator/wchar_t/move.cc:
	Likewise.
	* testsuite/21_strings/basic_string/allocator/wchar_t/move_assign.cc:
	Likewise.
	* testsuite/21_strings/basic_string/allocator/wchar_t/noexcept.cc:
	Likewise.
	* testsuite/21_strings/basic_string/allocator/wchar_t/swap.cc:
	Likewise.
	* testsuite/23_containers/list/61347.cc: Likewise.
	* testsuite/27_io/basic_fstream/cons/base.cc: Likewise.
	* testsuite/27_io/ios_base/failure/cxx11.cc: Likewise.

From-SVN: r244440
2017-01-13 14:57:33 +00:00
Ville Voutilainen e5dcfacf43 re PR libstdc++/78389 (list::merge and list::sort are not exception safe)
PR libstdc++/78389
* include/bits/list.tcc (merge(list&&)):
Adjust list sizes if the comparator throws.
(merge(list&&, _StrictWeakOrdering)): Likewise.
(sort()): Splice elements back from the scratch buffers
if the comparator throws.
(sort(_StrictWeakOrdering)): Likewise.
* testsuite/23_containers/list/operations/78389.cc: New.

From-SVN: r244439
2017-01-13 16:46:25 +02:00
Jonathan Wakely 45cac8baeb Mark test as XFAIL for C++17 mode
* testsuite/23_containers/unordered_set/allocator/ext_ptr.cc: Mark
	XFAIL for C++17 until node reinsertion supports fancy pointers.

From-SVN: r244436
2017-01-13 13:01:48 +00:00
Jonathan Wakely c6ab906191 PR78361 recognise noexcept functions as referenceable
2017-01-13  Jonathan Wakely  <jwakely@redhat.com>

	PR libstdc++/78361
	* testsuite/20_util/add_pointer/value.cc: Test forming function
	pointers.

2017-01-13  Michael Brune  <lucdanton@free.fr>

	PR libstdc++/78361
	* include/std/type_traits (__is_referenceable): Handle noexcept
	function types.

From-SVN: r244432
2017-01-13 12:18:42 +00:00
Jonathan Wakely a1f009a65f PR77528 partially revert r244278 and define default constructors
PR libstdc++/77528
	* include/bits/stl_queue.h (queue, priority_queue): Remove default
	member-initializers and define default constructors as templates with
	constraints.
	* include/bits/stl_stack.h (stack): Likewise.
	* testsuite/23_containers/priority_queue/requirements/constructible.cc:
	New.
	* testsuite/23_containers/priority_queue/requirements/
	explicit_instantiation/1.cc: Test more instantiations.
	* testsuite/23_containers/priority_queue/requirements/
	explicit_instantiation/1_c++98.cc: Likewise.
	* testsuite/23_containers/queue/requirements/constructible.cc: New.
	* testsuite/23_containers/stack/requirements/constructible.cc: New.

From-SVN: r244374
2017-01-12 17:28:36 +00:00
Jonathan Wakely 4704f28e7a PR66284 remove std::function special case for reference_wrapper
PR libstdc++/66284
	* doc/xml/manual/intro.xml: Document LWG 2781 change.
	* doc/html/*: Regenerate.
	* include/std/functional (_Function_base::_Ref_manager): Remove.
	(_Function_handler): Remove partial specializations for
	reference_wrapper.
	(function::target): Remove special case for const qualification.
	* testsuite/20_util/function/6.cc: Adjust tests for target type.
	* testsuite/20_util/function/7.cc: Likewise.
	* testsuite/20_util/function/8.cc: Likewise.

From-SVN: r244364
2017-01-12 14:28:38 +00:00
Jonathan Wakely b744bf4e18 PR78134 fix return types of heterogeneous lookup functions
PR libstdc++/78134
	* include/bits/stl_map.h (map::lower_bound, map::upper_bound)
	(map::equal_range): Fix return type of heterogeneous overloads.
	* include/bits/stl_multimap.h (multimap::lower_bound)
	(multimap::upper_bound, multimap::equal_range): Likewise.
	* include/bits/stl_multiset.h (multiset::lower_bound)
	(multiset::upper_bound, multiset::equal_range): Likewise.
	* include/bits/stl_set.h (set::lower_bound, set::upper_bound)
	(set::equal_range): Likewise.
	* testsuite/23_containers/map/operations/2.cc
	* testsuite/23_containers/multimap/operations/2.cc
	* testsuite/23_containers/multiset/operations/2.cc
	* testsuite/23_containers/set/operations/2.cc

From-SVN: r244318
2017-01-11 14:44:15 +00:00
Jonathan Wakely b091b8dc0b PR78273 fix count to work with partitioning function
PR libstdc++/78273
	* include/bits/stl_map.h (map::count<_Kt>(const _Kt&)): Don't assume
	the heterogeneous comparison can only find one match.
	* include/bits/stl_set.h (set::count<_Kt>(const _Kt&)): Likewise.
	* testsuite/23_containers/map/operations/2.cc: Test count works with
	comparison function that just partitions rather than sorting.
	* testsuite/23_containers/set/operations/2.cc: Likewise.

From-SVN: r244317
2017-01-11 14:44:04 +00:00
Ville Voutilainen f3df0b3cde Reduce the size of variant, it doesn't need an index of type size_t internally.
Reduce the size of variant, it doesn't need an index of
type size_t internally.
* include/std/variant (parse_numbers.h): New include.
(__select_index): New.
(_Variant_storage<false, _Types...>::_M_reset_impl): Use
_index_type for comparison with variant_npos.
(_Variant_storage<false, _Types...>::__index_type): New.
(_Variant_storage<false, _Types...>::_M_index): Change the
type from size_t to __index_type.
(_Variant_storage<true, _Types...>::__index_type): New.
(_Variant_storage<true, _Types...>::_M_index): Change the
type from size_t to __index_type.
(_Variant_base::_M_valid): Use _Storage::__index_type
for comparison with variant_npos.
(variant::index): Use _Base::_Storage::__index_type
for comparison with variant_npos.
* testsuite/20_util/variant/index_type.cc: New.

From-SVN: r244309
2017-01-11 13:23:43 +02:00
Jonathan Wakely 904112f6bb Adjust effective target selector to fix C++17 FAIL
* testsuite/18_support/exception_ptr/60612-unexpected.cc: Adjust
	effective target selector to prevent running in C++17 mode.

From-SVN: r244280
2017-01-10 17:44:42 +00:00
Jonathan Wakely d2e1d4b713 PR77528 add default constructors for container adaptors
PR libstdc++/77528
	* include/bits/stl_queue.h (queue::c): Add default member initializer.
	(queue::queue()): Add constructor and define as defaulted.
	(queue::queue(_Sequence&&)): Remove default argument.
	(priority_queue::c, priority_queue::comp): Add default member
	initializers.
	(priority_queue::priority_queue()): Add constructor and define as
	defaulted.
	(priority_queue::priority_queue(const _Compare&, _Sequence&&)):
	Remove default argument for first parameter.
	* include/bits/stl_stack.h (stack::c): Add default member initializer.
	(stack::stack()): Add constructor and define as defaulted.
	(stack::stack(const _Sequence&)): Remove default argument.
	* testsuite/23_containers/priority_queue/requirements/
	explicit_instantiation/1.cc: Test explicit instantiation with
	non-DefaultConstructible sequence.
	* testsuite/23_containers/priority_queue/77528.cc: New test.
	* testsuite/23_containers/priority_queue/requirements/
	explicit_instantiation/1_c++0x.cc: Replace with 1_c++98.cc.
	* testsuite/23_containers/queue/77528.cc: New test.
	* testsuite/23_containers/queue/requirements/explicit_instantiation/
	1.cc: Test explicit instantiation with non-DefaultConstructible
	sequence.
	* testsuite/23_containers/queue/requirements/explicit_instantiation/
	1_c++0x.cc: Replace with 1_c++98.cc.
	* testsuite/23_containers/stack/77528.cc: New test.
	* testsuite/23_containers/stack/requirements/explicit_instantiation/
	1.cc: Test explicit instantiation with non-DefaultConstructible
	sequence.
	* testsuite/23_containers/stack/requirements/explicit_instantiation/
	1_c++0x.cc: Replace with 1_c++98.cc.

From-SVN: r244278
2017-01-10 17:30:20 +00:00
François Dumont f9a27859df Make Python printers and xmethods work with versioned namespace
2017-01-10  François Dumont  <fdumont@gcc.gnu.org>
	    Jonathan Wakely  <jwakely@redhat.com>

	* python/libstdcxx/v6/printers.py (_versioned_namespace): Define.
	(is_specialization, strip_versioned_namespace): New helpers functions
	to work with symbols in the versioned namespace.
	(Printer.add_version): Add second name using versioned namespace.
	(add_one_template_type_printer, add_one_type_printer): Add second
	type printers using versioned namespace.
	(register_type_printers): Add template type printer for basic_string.
	(build_libstdcxx_dictionary): Remove dead code.
	* python/libstdcxx/v6/xmethods.py: Make all matchers look for
	versioned namespace.
	* testsuite/libstdc++-prettyprinters/48362.cc: Adjust expected
	results.
	* testsuite/libstdc++-prettyprinters/whatis.cc: Likewise.

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

From-SVN: r244262
2017-01-10 12:38:42 +00:00
Jonathan Wakely dc8bc65be3 Define testsuite macro for correct thread_local destructors
* testsuite/30_threads/condition_variable/members/3.cc: Use new macro
	to detect correct thread_local destructors.
	* testsuite/util/testsuite_hooks.h (CORRECT_THREAD_LOCAL_DTORS):
	Define.

From-SVN: r244226
2017-01-09 13:06:03 +00:00
Jonathan Wakely 3330ac383c Add more tests for std::basic_string::find
* testsuite/21_strings/basic_string/operations/find/char/6.cc: New.
	* testsuite/21_strings/basic_string/operations/find/wchar_t/6.cc: New.

From-SVN: r244185
2017-01-06 21:22:40 +00:00
Jonathan Wakely 3907f9e59c Add missing <cassert> include to testcase
* testsuite/util/performance/priority_queue/mem_usage/pop_test.hpp:
	Include <cassert> header.

From-SVN: r244176
2017-01-06 17:51:24 +00:00
Rainer Orth 1ec62aa9e1 Build libgo with -Wa,-nH if possible (PR go/78978) [non-libgo parts]
libstdc++-v3:
	PR go/78978
	* acinclude.m4 (GLIBCXX_CHECK_ASSEMBLER_HWCAP): Remove.
	* configure.ac: Call GCC_CHECK_ASSEMBLER_HWCAP instead of
	GLIBCXX_CHECK_ASSEMBLER_HWCAP.
	* fragment.am (CONFIG_CXXFLAGS): Use HWCAP_CFLAGS instead of
	HWCAP_FLAGS.
	* aclocal.m4: Regenerate.
	* configure: Regenerate.
	* Makefile.in, doc/Makefile.in, include/Makefile.in,
	libsupc++/Makefile.in, po/Makefile.in, python/Makefile.in,
	src/Makefile.in, src/c++11/Makefile.in, src/c++98/Makefile.in,
	src/filesystem/Makefile.in, testsuite/Makefile.in: Regenerate.

	config:
	PR go/78978
	* hwcaps.m4 (GCC_CHECK_ASSEMBLER_HWCAP): New macro.

From-SVN: r244162
2017-01-06 14:33:47 +00:00
Jonathan Wakely 6807f08628 PR78991 make __gnu_cxx::__ops constructors explicit
PR libstdc++/78991
	* include/bits/predefined_ops.h (_Iter_comp_iter, _Iter_comp_val)
	(_Val_comp_iter, _Iter_equals_val, _Iter_pred, _Iter_comp_to_val)
	(_Iter_comp_to_iter, _Iter_negate): Make constructors explicit and
	move function objects.
	(__iter_comp_iter, __iter_comp_val, __val_comp_iter, __pred_iter)
	(__iter_comp_val, __iter_comp_iter, __negate): Move function objects.
	* testsuite/25_algorithms/sort/78991.cc: New test.

From-SVN: r244150
2017-01-06 12:33:58 +00:00
Ville Voutilainen 1308676957 Implement 2801, Default-constructibility of unique_ptr.
* include/bits/unique_ptr.h (__uniq_ptr_impl::_DeleterConstraint): New.
(unique_ptr::_DeleterConstraint): Likewise.
(unique_ptr()): Constrain.
(unique_ptr(pointer)): Likewise.
(unique_ptr(nullptr_t)): Likewise.
(unique_ptr<_Tp[], _Dp>::_DeleterConstraint): New.
(unique_ptr<_Tp[], _Dp>::unique_ptr()): Constrain.
(unique_ptr<_Tp[], _Dp>::unique_ptr(_Up)): Likewise.
(unique_ptr<_Tp[], _Dp>::unique_ptr(nullptr_t)): Likewise.
* testsuite/20_util/unique_ptr/assign/48635_neg.cc: Adjust.
* testsuite/20_util/unique_ptr/cons/cv_qual_neg.cc: Likewise.
* testsuite/20_util/unique_ptr/cons/default.cc: New.
* testsuite/20_util/unique_ptr/cons/ptr_deleter_neg.cc: Adjust.

From-SVN: r244054
2017-01-04 15:21:02 +02:00
Pauli Nieminen ed3cb49703 Support exception propagation without lock-free atomic int
2017-01-04  Pauli Nieminen  <suokkos@gmail.com>
	    Jonathan Wakely  <jwakely@redhat.com>

	PR libstdc++/64735
	* acinclude.m4 (GLIBCXX_CHECK_EXCEPTION_PTR_SYMVER): Define.
	* config.h.in: Regenerate.
	* config/abi/pre/gnu.ver [HAVE_EXCEPTION_PTR_SINCE_GCC46]
	(GLIBCXX_3.4.15, GLIBCXX_3.4.21, CXXABI_1.3.3, CXXABI_1.3.5): Make
	exports for exception_ptr, nested_exception, and future conditional.
	[HAVE_EXCEPTION_PTR_SINCE_GCC46] (GLIBCXX_3.4.23, CXXABI_1.3.11): Add
	exports for exception_ptr, nested_exception, and future conditional.
	* configure: Regenerate.
	* configure.ac: Use GLIBCXX_CHECK_EXCEPTION_PTR_SYMVER.
	* include/std/future: Remove check for ATOMIC_INT_LOCK_FREE
	* libsupc++/eh_atomics.h: New file for internal use only.
	(__eh_atomic_inc, __eh_atomic_dec): New.
	* libsupc++/eh_ptr.cc (exception_ptr::_M_addref)
	(exception_ptr::_M_release) (__gxx_dependent_exception_cleanup)
	(rethrow_exception): Use eh_atomics.h reference counting helpers.
	* libsupc++/eh_throw.cc (__gxx_exception_cleanup): Likewise.
	* libsupc++/eh_tm.cc (free_any_cxa_exception): Likewise.
	* libsupc++/exception: Remove check for ATOMIC_INT_LOCK_FREE.
	* libsupc++/exception_ptr.h: Likewise.
	* libsupc++/guard.cc: Include header for ATOMIC_INT_LOCK_FREE macro.
	* libsupc++/nested_exception.cc: Remove check for
	ATOMIC_INT_LOCK_FREE.
	* libsupc++/nested_exception.h: Likewise.
	* src/c++11/future.cc: Likewise.
	* testsuite/18_support/exception_ptr/*: Remove atomic builtins checks.
	* testsuite/18_support/nested_exception/*: Likewise.
	* testsuite/30_threads/async/*: Likewise.
	* testsuite/30_threads/future/*: Likewise.
	* testsuite/30_threads/headers/future/types_std_c++0x.cc: Likewise.
	* testsuite/30_threads/packaged_task/*: Likewise.
	* testsuite/30_threads/promise/*: Likewise.
	* testsuite/30_threads/shared_future/*: Likewise.

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

From-SVN: r244051
2017-01-04 10:54:59 +00:00
Jonathan Wakely 80efc5073d Add deleted std::thread(const thread&&) constructor
PR libstdc++/78956
	* include/std/thread (thread(const thread&&)): Add deleted
	constructor.
	* testsuite/30_threads/thread/cons/lwg2097.cc: New test.

From-SVN: r244022
2017-01-03 13:31:26 +00:00
Jakub Jelinek cbe34bb5ed Update copyright years.
From-SVN: r243994
2017-01-01 13:07:43 +01:00
Ville Voutilainen 2ae2d394c1 Implement LWG 2842, in_place_t check for optional::optional(U&&) should decay U.
Implement LWG 2842, in_place_t check for optional::optional(U&&)
should decay U.
* include/std/optional (_Optional_base(in_place_t, _Args&&...)):
Constrain.
(_Optional_base(in_place_t, initializer_list<_Up>, _Args&&...)):
Turn the int-pack constraint hack into a saner bool.
(_Optional_base<_Tp, false>::_Optional_base(in_place_t, _Args&&...)):
Constrain.
(_Optional_base<_Tp, false>::_Optional_base(in_place_t,
initializer_list<_Up>, _Args&&...)):
Turn the int-pack constraint hack into a saner bool.
(optional(_Up&&)): Constrain against in_place_t.
(optional(in_place_t, _Args&&...)): Constrain.
(constexpr optional(in_place_t, initializer_list<_Up>, _Args&&...)):
Turn the int-pack constraint hack into a saner bool.
* testsuite/20_util/optional/cons/value_neg.cc: Add a test for
a type that is constructible from in_place.

From-SVN: r243966
2016-12-29 21:19:59 +02:00
Jason Merrill 57a6add274 Fix handling of explicit function template arguments with TTPs.
gcc/cp/
	* pt.c (coerce_template_parms): Consider variadic_args_p before
	complaining about too many template arguments.
libstdc++-v3/
	* testsuite/util/testsuite_tr1.h (test_property): Don't define both
	variadic and non-variadic overloads.

From-SVN: r243869
2016-12-21 14:38:44 -05:00
Jonathan Wakely e76d309851 PR 71444 define more error constants for mingw-w64
PR libstdc++/71444
	* config/os/mingw32-w64/error_constants.h
	(address_family_not_supported, address_in_use, address_not_available)
	(already_connected, connection_aborted, connection_already_in_progress)
	connection_refused, connection_reset, cross_device_link)
	(destination_address_required, host_unreachable, message_size)
	(network_down, network_reset, network_unreachable, no_buffer_space)
	(no_protocol_option, not_a_socket, not_connected, operation_canceled)
	(operation_in_progress, operation_not_supported, protocol_error)
	(protocol_not_supported, too_many_links, too_many_symbolic_link_levels)
	(value_too_large, wrong_protocol_type): Define.
	(bad_message, identifier_removed, no_link, no_message_available)
	(no_message, no_stream_resources, not_a_stream, owner_dead)
	(state_not_recoverable, stream_timeout, text_file_busy): Define
	conditionally.
	* testsuite/19_diagnostics/headers/system_error/errc_std_c++0x.cc:
	Guard test for no_message with _GLIBCXX_HAVE_ENOMSG.

From-SVN: r243853
2016-12-21 13:09:13 +00:00
Ville Voutilainen 4b21c3ea03 Make the perfect-forwarding constructor of a two-element tuple sfinae away when the first argument is an allocator_arg.
Make the perfect-forwarding constructor of a two-element tuple
sfinae away when the first argument is an allocator_arg.
* include/std/tuple (tuple(_U1&&, _U2&&)): Constrain.
* testsuite/20_util/tuple/cons/allocator_with_any.cc: New.
* testsuite/20_util/tuple/element_access/get_neg.cc: Adjust.

From-SVN: r243795
2016-12-19 14:55:33 +02:00
Jonathan Wakely 36b8852641 Add assertion to _Rb_tree::erase to check for end iterators
* include/bits/stl_tree.h (_Rb_tree::_M_erase_aux(const_iterator)):
	Add assertion for undefined argument.
	(_Rb_tree::_M_erase_aux(const_iterator, const_iterator)): Call
	_M_erase_aux directly instead of through erase.
	(_Rb_tree::_M_erase_aux(const Key&)): Likewise.
	* testsuite/23_containers/map/modifiers/erase/end_neg.cc: New test.

From-SVN: r243757
2016-12-16 18:13:09 +00:00
Ville Voutilainen 6254952346 Implement LWG 2769, Redundant const in the return type of any_cast(const any&).
Implement LWG 2769, Redundant const in the return type of
any_cast(const any&).
* include/std/any (_AnyCast): New.
(any_cast(const any&)): Use it and add an explicit cast for return.
(any_cast(any&)): Likewise.
(any_cast(any&&)): Likewise.
* testsuite/20_util/any/misc/any_cast.cc: Add a test for a type
that has an explicit copy constructor.
*testsuite/20_util/any/misc/any_cast_neg.cc: Adjust.

From-SVN: r243739
2016-12-16 13:34:45 +02:00
Jonathan Wakely bdfc9f5c54 PR59170 make pretty printers check for singular iterators
PR libstdc++/59170
	* python/libstdcxx/v6/printers.py (StdListIteratorPrinter.to_string)
	(StdSlistIteratorPrinter.to_string, StdVectorIteratorPrinter.to_string)
	(StdRbtreeIteratorPrinter.to_string)
	(StdDequeIteratorPrinter.to_string): Add check for value-initialized
	iterators.
	* testsuite/libstdc++-prettyprinters/simple.cc: Test them.
	* testsuite/libstdc++-prettyprinters/simple11.cc: Likewise.

From-SVN: r243692
2016-12-15 14:13:36 +00:00
Jonathan Wakely 50a8a9413d PR59161 make pretty printers always return strings
PR libstdc++/59161
	* python/libstdcxx/v6/printers.py (StdListIteratorPrinter.to_string)
	(StdSlistIteratorPrinter.to_string, StdVectorIteratorPrinter.to_string)
	(StdRbtreeIteratorPrinter.to_string, StdDequeIteratorPrinter.to_string)
	(StdDebugIteratorPrinter.to_string): Return string instead of
	gdb.Value.
	* testsuite/libstdc++-prettyprinters/59161.cc: New test.

From-SVN: r243690
2016-12-15 13:25:22 +00:00
Jonathan Wakely 0376e86bfc Add GDB XMethods for shared_ptr and unique_ptr<T[]>
* python/libstdcxx/v6/xmethods.py (UniquePtrGetWorker.__init__): Use
	correct element type for unique_ptr<T[]>.
	(UniquePtrGetWorker._supports, UniquePtrDerefWorker._supports): New
	functions to disable unsupported operators for unique_ptr<T[]>.
	(UniquePtrSubscriptWorker): New worker for operator[].
	(UniquePtrMethodsMatcher.__init__): Register UniquePtrSubscriptWorker.
	(UniquePtrMethodsMatcher.match): Call _supports on the chosen worker.
	(SharedPtrGetWorker, SharedPtrDerefWorker, SharedPtrSubscriptWorker)
	(SharedPtrUseCountWorker, SharedPtrUniqueWorker): New workers.
	(SharedPtrMethodsMatcher): New matcher for shared_ptr.
	(register_libstdcxx_xmethods): Register SharedPtrMethodsMatcher.
	* testsuite/libstdc++-xmethods/unique_ptr.cc: Test arrays.
	* testsuite/libstdc++-xmethods/shared_ptr.cc: New test.

From-SVN: r243688
2016-12-15 12:45:42 +00:00
Jonathan Wakely d33c00e1ce Make printers use singular noun for a single element
* python/libstdcxx/v6/printers.py (num_elements): New function.
	(StdMapPrinter.to_string, StdSetPrinter.to_string)
	(StdDequePrinter.to_string, Tr1UnorderedSetPrinter.to_string)
	(Tr1UnorderedMapPrinter.to_string): Use num_elements.
	* testsuite/libstdc++-prettyprinters/cxx11.cc: Adjust expected results
	to use singular noun when there is only one element.
	* testsuite/libstdc++-prettyprinters/debug.cc: Likewise.
	* testsuite/libstdc++-prettyprinters/debug_cxx11.cc: Likewise.
	* testsuite/libstdc++-prettyprinters/simple.cc: Likewise.
	* testsuite/libstdc++-prettyprinters/simple11.cc: Likewise.
	* testsuite/libstdc++-prettyprinters/tr1.cc: Likewise.

From-SVN: r243652
2016-12-14 16:07:29 +00:00
Jonathan Wakely 3c760f4a79 Make printers detect invalid debug mode iterators
PR libstdc++/59170
	* python/libstdcxx/v6/printers.py (StdDebugIteratorPrinter): Use
	_M_sequence and _M_version to detect invalid iterators.
	* testsuite/libstdc++-prettyprinters/debug.cc: Test debug mode vector
	and test invalid iterators.
	* testsuite/libstdc++-prettyprinters/debug_cxx11.cc: New test.

From-SVN: r243650
2016-12-14 15:17:57 +00:00
Kyrylo Tkachov 39c429372b [libstdc++][testsuite] XFAIL tests relying on long double-to-string conversions on broken newlib
* lib/target-supports.exp
    (check_effective_target_newlib_broken_long_double_io): New check.
    (check_effective_target_frexpl): Likewise.

    * testsuite/21_strings/basic_string/numeric_conversions/char/stod.cc:
    XFAIL run if newlib_broken_long_double_io.
    * testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stod.cc:
    Likewise.
    * testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stold.cc:
    Likewise.
    * testsuite/27_io/basic_ostream/inserters_arithmetic/char/hexfloat.cc:
    Likewise.

From-SVN: r243558
2016-12-12 15:47:47 +00:00
Jonathan Wakely 1c43384234 Remove stray character at end of dg-do directive
* testsuite/experimental/filesystem/operations/is_empty.cc:
	Remove stray character at end of dg-do directive.

From-SVN: r243555
2016-12-12 14:32:23 +00:00
Jonathan Wakely 8152d6eff6 Remove stray character at end of dg-do directive
* testsuite/experimental/filesystem/operations/temp_directory_path.cc:
	Remove stray character at end of dg-do directive.

From-SVN: r243548
2016-12-12 12:44:46 +00:00
David Edelsohn 410aa8982f parallel_algorithm_assert2.cc: Move dg-do run first.
* testsuite/25_algorithms/headers/algorithm/
        parallel_algorithm_assert2.cc: Move dg-do run first.

From-SVN: r243468
2016-12-08 17:35:24 -05:00
Jonathan Wakely fdb0b271e8 Fix filesystem test that fails in debug mode
* testsuite/experimental/filesystem/path/construct/range.cc: Don't
	use basic_string::front() when string might be empty.

From-SVN: r243438
2016-12-08 13:25:09 +00:00
Jonathan Wakely 1d752b4fee Delete std::swap for debug mode array
* include/debug/array (swap): Add deleted overload.
	* include/bits/stl_pair.h (swap): Remove redundant inline keyword
	from deleted overload.
	* include/bits/unique_ptr.h (swap): Likewise.
	* include/std/array (swap): Likewise.
	* include/std/optional (swap): Likewise.
	* include/std/tuple (swap): Likewise.
	* include/std/variant (swap): Likewise.
	* testsuite/23_containers/array/tuple_interface/get_debug_neg.cc:
	Adjust dg-error line numbers.
	* testsuite/23_containers/array/tuple_interface/get_neg.cc: Likewise.
	* testsuite/23_containers/array/tuple_interface/
	tuple_element_debug_neg.cc: Likewise.
	* testsuite/23_containers/array/tuple_interface/tuple_element_neg.cc:
	Likewise.

From-SVN: r243437
2016-12-08 13:25:03 +00:00
Jonathan Wakely eae0b895e0 PR71856 try to fix Parallel Mode assertions again
PR libstdc++/71856
	* doc/xml/manual/using.xml: Document macro.
	* include/bits/c++config [_GLIBCXX_DEBUG || _GLIBCXX_PARALLEL]
	(__glibcxx_assert): Rename to __glibcxx_assert_impl.
	[_GLIBCXX_DEBUG] (__glibcxx_assert): Expand to __glibcxx_assert_impl.
	* include/parallel/base.h [_GLIBCXX_PARALLEL_ASSERTIONS]
	(_GLIBCXX_PARALLEL_ASSERT): Expand to __glibcxx_assert_impl.
	[!_GLIBCXX_PARALLEL_ASSERTIONS] (_GLIBCXX_PARALLEL_ASSERT): Define as
	empty.
	* testsuite/25_algorithms/headers/algorithm/
	parallel_algorithm_assert2.cc: New test.

From-SVN: r243434
2016-12-08 12:08:14 +00:00
Jakub Jelinek 1d09844a1c P0003R5 - removal of dynamic exception specification from C++17
P0003R5 - removal of dynamic exception specification from C++17
	* parser.c (cp_parser_exception_specification_opt): For C++17
	error out on throw ( type-id-list ), for C++11 and C++14 issue
	-Wdeprecated warning on it.  Formatting fix.  Treat throw()
	in C++17 as noexcept(true).

	* g++.dg/compat/eh/ctor1.h: Adjust for deprecation of
	throw (type-id-list) in C++11 and C++14 and removal in C++17.
	* g++.dg/compat/eh/ctor1_y.C: Likewise.
	* g++.dg/compat/eh/new1_x.C: Likewise.
	* g++.dg/compat/eh/new1_y.C: Likewise.
	* g++.dg/compat/eh/spec3_x.C: Likewise.
	* g++.dg/compat/eh/spec3_y.C: Likewise.
	* g++.dg/compat/eh/template1.h: Likewise.
	* g++.dg/compat/eh/template1_y.C: Likewise.
	* g++.dg/compat/eh/unexpected1_x.C: Likewise.
	* g++.dg/compat/eh/unexpected1_y.C: Likewise.
	* g++.dg/cpp0x/auto9.C: Likewise.
	* g++.dg/cpp0x/defaulted23.C: Likewise.
	* g++.dg/cpp0x/error5.C: Likewise.
	* g++.dg/cpp0x/lambda/lambda-eh2.C: Likewise.
	* g++.dg/cpp0x/noexcept02.C: Likewise.
	* g++.dg/cpp0x/noexcept07.C: Likewise.
	* g++.dg/cpp0x/noexcept08.C: Likewise.
	* g++.dg/cpp0x/noexcept19.C: Likewise.
	* g++.dg/cpp0x/variadic73.C: Likewise.
	* g++.dg/cpp0x/variadic-throw.C: Likewise.
	* g++.dg/cpp1z/noexcept-type1.C: Likewise.
	* g++.dg/eh/async-unwind2.C: Likewise.
	* g++.dg/eh/cond4.C: Likewise.
	* g++.dg/eh/delete1.C: Likewise.
	* g++.dg/eh/ehopt1.C: Likewise.
	* g++.dg/eh/forced3.C: Likewise.
	* g++.dg/eh/forced4.C: Likewise.
	* g++.dg/eh/init-temp2.C: Likewise.
	* g++.dg/eh/pr38662.C: Likewise.
	* g++.dg/eh/pr41819.C: Likewise.
	* g++.dg/eh/shadow1.C: Likewise.
	* g++.dg/eh/spec2.C: Likewise.
	* g++.dg/eh/spec3.C: Likewise.
	* g++.dg/eh/spec5.C: Likewise.
	* g++.dg/eh/spec6.C: Likewise.
	* g++.dg/eh/spec7.C: Likewise.
	* g++.dg/eh/spec8.C: Likewise.
	* g++.dg/eh/spec9.C: Likewise.
	* g++.dg/eh/template1.C: Likewise.
	* g++.dg/eh/unexpected1.C: Likewise.
	* g++.dg/ext/has_nothrow_assign.C: Likewise.
	* g++.dg/ext/has_nothrow_constructor.C: Likewise.
	* g++.dg/ext/has_nothrow_copy-1.C: Likewise.
	* g++.dg/ext/has_nothrow_copy-2.C: Likewise.
	* g++.dg/ext/has_nothrow_copy-4.C: Likewise.
	* g++.dg/ext/has_nothrow_copy-5.C: Likewise.
	* g++.dg/ext/has_nothrow_copy-6.C: Likewise.
	* g++.dg/ext/has_nothrow_copy-7.C: Likewise.
	* g++.dg/gcov/gcov-7.C: Likewise.
	* g++.dg/init/new13.C: Likewise.
	* g++.dg/init/new25.C: Likewise.
	* g++.dg/lookup/exception1.C: Likewise.
	* g++.dg/opt/noreturn-1.C: Likewise.
	* g++.dg/other/error3.C: Likewise.
	* g++.dg/rtti/crash3.C: Likewise.
	* g++.dg/template/eh2.C: Likewise.
	* g++.dg/template/error36.C: Likewise.
	* g++.dg/tm/pr46567.C: Likewise.
	* g++.dg/tm/pr47340.C: Likewise.
	* g++.dg/torture/pr46364.C: Likewise.
	* g++.dg/torture/pr49394.C: Likewise.
	* g++.dg/torture/pr52918-1.C: Likewise.
	* g++.dg/torture/pr57190.C: Likewise.
	* g++.dg/torture/stackalign/eh-alloca-1.C: Likewise.
	* g++.dg/torture/stackalign/eh-fastcall-1.C: Likewise.
	* g++.dg/torture/stackalign/eh-global-1.C: Likewise.
	* g++.dg/torture/stackalign/eh-inline-1.C: Likewise.
	* g++.dg/torture/stackalign/eh-inline-2.C: Likewise.
	* g++.dg/torture/stackalign/eh-thiscall-1.C: Likewise.
	* g++.dg/torture/stackalign/eh-vararg-1.C: Likewise.
	* g++.dg/torture/stackalign/eh-vararg-2.C: Likewise.
	* g++.dg/tree-ssa/pr45605.C: Likewise.
	* g++.dg/warn/Wreturn-type-3.C: Likewise.
	* g++.old-deja/g++.eh/badalloc1.C: Likewise.
	* g++.old-deja/g++.eh/cleanup2.C: Likewise.
	* g++.old-deja/g++.eh/spec1.C: Likewise.
	* g++.old-deja/g++.eh/spec2.C: Likewise.
	* g++.old-deja/g++.eh/spec3.C: Likewise.
	* g++.old-deja/g++.eh/spec4.C: Likewise.
	* g++.old-deja/g++.eh/spec6.C: Likewise.
	* g++.old-deja/g++.eh/throw1.C: Likewise.
	* g++.old-deja/g++.eh/throw2.C: Likewise.
	* g++.old-deja/g++.eh/tmpl1.C: Likewise.
	* g++.old-deja/g++.eh/tmpl3.C: Likewise.
	* g++.old-deja/g++.mike/eh15.C: Likewise.
	* g++.old-deja/g++.mike/eh25.C: Likewise.
	* g++.old-deja/g++.mike/eh33.C: Likewise.
	* g++.old-deja/g++.mike/eh34.C: Likewise.
	* g++.old-deja/g++.mike/eh50.C: Likewise.
	* g++.old-deja/g++.mike/eh51.C: Likewise.
	* g++.old-deja/g++.mike/eh55.C: Likewise.
	* g++.old-deja/g++.mike/p10416.C: Likewise.
	* g++.old-deja/g++.other/crash28.C: Likewise.
	* g++.old-deja/g++.other/crash30.C: Likewise.
	* g++.old-deja/g++.other/new7.C: Likewise.
	* g++.old-deja/g++.pt/ehspec1.C: Likewise.
	* g++.old-deja/g++.robertl/eb123.C: Likewise.

	* testsuite/util/testsuite_new_operators.h: Include testsuite_hooks.h.
	(operator new): Use THROW macro.

From-SVN: r243429
2016-12-08 09:26:06 +01:00
Jonathan Wakely d71f5aa799 Replace use of C++14 std::exchange in C++11 testcase
* testsuite/28_regex/traits/char/user_defined.cc: Replace uses of
	C++14 std::exchange function.

From-SVN: r243354
2016-12-07 15:22:57 +00:00
Jonathan Wakely 1f153a1d2a Replace dynamic exception specifications in testsuite
* testsuite/util/testsuite_hooks.h (THROW): Define.
	* testsuite/util/replacement_memory_operators.h: Include
	testsuite_hooks.h and use THROW macro.
	* testsuite/util/testsuite_tr1.h: Likewise.
	* testsuite/20_util/allocator/1.cc: Use THROW macro.
	* testsuite/22_locale/locale/cons/12352.cc: Likewise.
	* testsuite/23_containers/vector/zero_sized_allocations.cc: Likewise.
	* testsuite/30_threads/lock_guard/cons/1.cc: Replace dynamic exception
	specification with noexcept-specifier.
	* testsuite/ext/pool_allocator/allocate_chunk.cc: Include
	testsuite_hooks.h and use THROW macro.
	* testsuite/ext/profile/replace_new.cc: Likewise.

From-SVN: r243353
2016-12-07 15:22:51 +00:00
Jonathan Wakely 101ee3cc73 Disable test using std::set_unexcepted for C++17
* testsuite/18_support/bad_exception/59392.cc: Disable for C++17.

From-SVN: r243351
2016-12-07 15:22:37 +00:00
Jonathan Wakely 63915a91ab Improve tests for contents of <new> header
* testsuite/18_support/headers/new/synopsis.cc: Add C++14 and C++17
	declarations.
	* testsuite/18_support/headers/new/synopsis_cxx98.cc: New test.

From-SVN: r243349
2016-12-07 15:22:24 +00:00
Jonathan Wakely 449a432129 Fix pretty-printer for std::variant
* python/libstdcxx/v6/printers.py (StdVariantPrinter): Update for new
	data member name.
	* testsuite/libstdc++-prettyprinters/cxx17.cc: Remove redundant test.

From-SVN: r243304
2016-12-06 14:36:07 +00:00
Tim Shen b01af236b7 variant (visit): Make visit constexpr.
* include/std/variant (visit): Make visit constexpr. Also cleanup
	__get_alternative and __storage, since we don't support reference/void
	alternatives any more.
	* testsuite/20_util/variant/compile.cc: Add tests.

From-SVN: r243295
2016-12-06 11:28:09 +00:00
Tim Shen 458ef69052 enable_special_members.h: Make _Enable_default_constructor constexpr.
* include/bits/enable_special_members.h: Make
	_Enable_default_constructor constexpr.
	* include/std/variant (variant::emplace, variant::swap, std::swap,
	std::hash): Sfinae on emplace and std::swap; handle __poison_hash bases
	of duplicated types.
	* testsuite/20_util/variant/compile.cc: Add tests.
	* testsuite/20_util/variant/hash.cc: Add tests.

From-SVN: r243294
2016-12-06 11:26:48 +00:00
Tim Shen 9189f55908 variant (std::get, operator==): Implement constexpr comparison and get<>.
* include/std/variant (std::get, operator==): Implement constexpr
	comparison and get<>.
	* testsuite/20_util/variant/compile.cc: Tests.

From-SVN: r243293
2016-12-06 11:20:13 +00:00
Tim Shen 44f4688595 variant (__erased_use_alloc_ctor, [...]): Remove uses-allocator related functions.
* include/std/variant (__erased_use_alloc_ctor,
	_Variant_base::_Variant_base, variant::variant): Remove uses-allocator
	related functions.
	* testsuite/20_util/variant/compile.cc: Remove related tests.
	* testsuite/20_util/variant/run.cc: Remove related tests.

From-SVN: r243292
2016-12-06 11:17:56 +00:00
David Edelsohn 0269650d4a * testsuite/26_numerics/headers/cmath/hypot.cc: XFAIL on AIX.
From-SVN: r243127
2016-12-01 14:02:34 -05:00
Ville Voutilainen a2863bde75 Implement LWG 2766,
Swapping non-swappable types and LWG 2749,
swappable traits for variants.
* include/bits/move.h (swap(_Tp&, _Tp&)): Constrain
with __is_tuple_like.
* include/bits/stl_pair.h (swap(pair<_T1, _T2>&, pair<_T1, _T2>&)):
Add a deleted overload.
* include/bits/unique_ptr.h
(swap(unique_ptr<_Tp, _Dp>&, unique_ptr<_Tp, _Dp>&)): Likewise.
* include/std/array
(swap(array<_Tp, _Nm>&, array<_Tp, _Nm>&)): Likewise.
* include/std/optional
(swap(optional<_Tp>&, optional<_Tp>&)): Likewise.
* include/std/tuple (__is_tuple_like_impl, __is_tuple_like):
Move to type_traits.
(swap(tuple<_Elements...>&, tuple<_Elements...>&)): Add a deleted
overload.
* include/std/type_traits (__is_tuple_like_impl, __is_tuple_like):
New.
(swap(_Tp&, _Tp&)): Constrain with __is_tuple_like.
* include/std/utility (__is_tuple_like_impl): Move to type_traits.
* include/std/variant
(swap(variant<_Types...>&, variant<_Types...>&)):
Add a deleted overload.
* testsuite/20_util/optional/swap/2.cc: Add tests for disabled
swaps.
* testsuite/20_util/pair/swap_cxx17.cc: New.
* testsuite/20_util/tuple/swap_cxx17.cc: Likewise.
* testsuite/20_util/unique_ptr/specialized_algorithms/swap_cxx17.cc:
Likewise.
* testsuite/20_util/variant/compile.cc: Add tests for disabled
swaps.
* testsuite/23_containers/array/specialized_algorithms/swap_cxx17.cc:
New.
* testsuite/23_containers/array/tuple_interface/get_neg.cc: Adjust.
* testsuite/23_containers/array/tuple_interface/tuple_element_neg.cc:
Likewise.

From-SVN: r243120
2016-12-01 18:23:21 +02:00
Tim Shen 974afa584b re PR libstdc++/71500 (regex::icase only works on first character in a range)
PR libstdc++/71500
	* include/bits/regex.h (basic_regex::basic_regex): Use ECMAScript
	when the syntax is not specified.
	* include/bits/regex_compiler.h (_RegexTranslator,
	_RegexTranslatorBase): Partially support icase in ranges.
	* include/bits/regex_compiler.tcc (_BracketMatcher::_M_apply):
	Refactor _M_apply to make the control flow easier to follow, and
	call _M_translator._M_match_range as added previously.
	* testsuite/28_regex/traits/char/icase.cc: Add new tests.
	* testsuite/28_regex/traits/char/user_defined.cc: Add new tests.

From-SVN: r243093
2016-12-01 03:03:55 +00:00
David Edelsohn 6d0e8a552f 50594.cc: XFAIL on AIX.
* testsuite/18_support/50594.cc: XFAIL on AIX.
        * testsuite/ext/mt_allocator/check_new.cc: Same.
        * testsuite/ext/pool_allocator/check_new.cc: Same.
        * testsuite/27_io/ios_base/storage/11584.cc: Same.

From-SVN: r243023
2016-11-30 09:33:02 -05:00
Ville Voutilainen a7da488130 Implement LWG 2534, Constrain rvalue stream operators.
* include/std/istream (__is_convertible_to_basic_istream): New.
(__is_extractable): Likewise.
(operator>>(basic_istream<_CharT, _Traits>&&, _Tp&&)):
Turn the stream parameter into a template parameter
and constrain.
* include/std/ostream (__is_convertible_to_basic_ostream): New.
(__is_insertable): Likewise.
(operator<<(basic_ostream<_CharT, _Traits>&&, const _Tp&)):
Turn the stream parameter into a template parameter
and constrain.
* testsuite/27_io/basic_istream/extractors_other/char/4.cc: New.
* testsuite/27_io/basic_istream/extractors_other/wchar_t/4.cc:
Likewise.
* testsuite/27_io/basic_ostream/inserters_other/char/6.cc: Likewise.
* testsuite/27_io/basic_ostream/inserters_other/wchar_t/6.cc: Likewise.

From-SVN: r243006
2016-11-30 11:59:50 +02:00
Christophe Lyon dfad822a61 [libstdc++, testsuite] Add dg-require-thread-fence
2016-11-30  Christophe Lyon  <christophe.lyon@linaro.org>

	* testsuite/experimental/type_erased_allocator/2.cc: Add
	dg-require-thread-fence.

From-SVN: r243001
2016-11-30 09:49:01 +01:00
David Edelsohn 57e27acf28 re PR libstdc++/68838 (AIX 32 bit wchar_t testsuite failures)
PR libstdc++/68838
* testsuite/lib/libstdc++.exp (DEFAULT_CXXFLAGS): Add -Wl,-bmaxdata on AIX.
* testsuite/23_containers/vector/profile/vector.cc: Remove
dg-additional-options.

From-SVN: r242967
2016-11-29 12:50:27 -05:00
Tim Shen 3203ed5f01 re PR libstdc++/78441 ([variant] variant_alternative doesn't allow cv qualifiers)
PR libstdc++/78441
	* include/std/variant: Propagate cv qualifications to types returned
	by variant_alternative.
	* testsuite/20_util/variant/compile.cc: Tests.

From-SVN: r242892
2016-11-27 00:32:04 +00: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
Uros Bizjak b2b0acbe2b Makefile.in ($(lang_checks_parallelized)): Fix detection of -j argument.
gcc/ChangeLog

	* Makefile.in ($(lang_checks_parallelized)): Fix detection
	of -j argument.

gcc/ada/ChangeLog

	* gcc-interface/Make-lang.in (check-acats): Fix detection
	of -j argument.

libstdc++-v3/ChangeLog

	* testsuite/Makefile.am
	(check-DEJAGNU $(check_DEJAGNU_normal_targets)): Fix detection
	of -j argument.
	* testsuite/Makefile.in: Regenereate.

From-SVN: r242705
2016-11-22 17:33:43 +01:00
Jonathan Wakely dba814afda PR78465 Remove runtime tests for <atomic> macros
PR libstdc++/78465
	* testsuite/29_atomics/headers/atomic/macros.cc: Replace runtime tests
	with preprocessor conditions.

From-SVN: r242704
2016-11-22 16:31:19 +00:00
Jonathan Wakely 6ae2ae3b84 Make std::tuple_size<cv T> SFINAE-friendly (LWG 2770)
* doc/xml/manual/intro.xml: Document LWG 2770 status. Remove entries
	for 2742 and 2748.
	* doc/html/*: Regenerate.
	* include/std/utility (__tuple_size_cv_impl): New helper to safely
	detect tuple_size<T>::value, as per LWG 2770.
	(tuple_size<cv T>): Adjust partial specializations to derive from
	__tuple_size_cv_impl.
	* testsuite/20_util/tuple/cv_tuple_size.cc: Test SFINAE-friendliness.

From-SVN: r242452
2016-11-15 19:32:44 +00:00
Jonathan Wakely 6f959acccb Adjust pretty printer test for variant<T&>
* testsuite/libstdc++-prettyprinters/cxx17.cc: Adjust test for
	variant<T&>.

From-SVN: r242449
2016-11-15 19:29:07 +00:00
Tim Shen 7b277e8b46 variant: Remove variant<T&>...
* include/std/variant: Remove variant<T&>, variant<void>, variant<> support
	to rebase on the post-Issaquah design.
	* testsuite/20_util/variant/compile.cc: Likewise.

From-SVN: r242437
2016-11-15 17:26:59 +00:00
Jonathan Wakely c7cbb4dafb Fix find&replace error in license boilerplate
* testsuite/19_diagnostics/error_code/is_error_code_v.cc: Fix license
	text.
	* testsuite/20_util/any/assign/emplace.cc: Likewise.
	* testsuite/20_util/any/cons/in_place.cc: Likewise.
	* testsuite/20_util/any/make_any.cc: Likewise.
	* testsuite/20_util/any/requirements.cc: Likewise.
	* testsuite/20_util/any/typedefs.cc: Likewise.
	* testsuite/20_util/bind/is_placeholder_v.cc: Likewise.
	* testsuite/20_util/duration/requirements/treat_as_floating_point_v.cc:
	Likewise.
	* testsuite/20_util/in_place/requirements.cc: Likewise.
	* testsuite/20_util/optional/77288.cc: Likewise.
	* testsuite/20_util/optional/assignment/1.cc: Likewise.
	* testsuite/20_util/optional/assignment/2.cc: Likewise.
	* testsuite/20_util/optional/assignment/3.cc: Likewise.
	* testsuite/20_util/optional/assignment/4.cc: Likewise.
	* testsuite/20_util/optional/assignment/5.cc: Likewise.
	* testsuite/20_util/optional/assignment/6.cc: Likewise.
	* testsuite/20_util/optional/assignment/7.cc: Likewise.
	* testsuite/20_util/optional/cons/77727.cc: Likewise.
	* testsuite/20_util/optional/cons/move.cc: Likewise.
	* testsuite/20_util/optional/cons/value.cc: Likewise.
	* testsuite/20_util/optional/cons/value_neg.cc: Likewise.
	* testsuite/20_util/optional/constexpr/cons/value.cc: Likewise.
	* testsuite/20_util/optional/constexpr/make_optional.cc: Likewise.
	* testsuite/20_util/optional/constexpr/observers/1.cc: Likewise.
	* testsuite/20_util/optional/constexpr/observers/2.cc: Likewise.
	* testsuite/20_util/optional/constexpr/observers/3.cc: Likewise.
	* testsuite/20_util/optional/constexpr/observers/4.cc: Likewise.
	* testsuite/20_util/optional/constexpr/observers/5.cc: Likewise.
	* testsuite/20_util/optional/constexpr/relops/1.cc: Likewise.
	* testsuite/20_util/optional/constexpr/relops/2.cc: Likewise.
	* testsuite/20_util/optional/constexpr/relops/3.cc: Likewise.
	* testsuite/20_util/optional/constexpr/relops/4.cc: Likewise.
	* testsuite/20_util/optional/constexpr/relops/5.cc: Likewise.
	* testsuite/20_util/optional/constexpr/relops/6.cc: Likewise.
	* testsuite/20_util/optional/hash.cc: Likewise.
	* testsuite/20_util/optional/make_optional.cc: Likewise.
	* testsuite/20_util/optional/observers/1.cc: Likewise.
	* testsuite/20_util/optional/observers/2.cc: Likewise.
	* testsuite/20_util/optional/observers/3.cc: Likewise.
	* testsuite/20_util/optional/observers/4.cc: Likewise.
	* testsuite/20_util/optional/observers/5.cc: Likewise.
	* testsuite/20_util/optional/observers/6.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/relops/5.cc: Likewise.
	* testsuite/20_util/optional/relops/6.cc: Likewise.
	* testsuite/20_util/optional/requirements.cc: Likewise.
	* testsuite/20_util/optional/swap/1.cc: Likewise.
	* testsuite/20_util/optional/typedefs.cc: Likewise.
	* testsuite/20_util/ratio/requirements/ratio_equal_v.cc: Likewise.
	* testsuite/20_util/tuple/tuple_size_v.cc: Likewise.
	* testsuite/20_util/uses_allocator/requirements/uses_allocator_v.cc:
	Likewise.
	* testsuite/20_util/variable_templates_for_traits.cc: Likewise.
	* testsuite/20_util/variant/hash.cc: Likewise.
	* testsuite/21_strings/basic_string_view/typedefs.cc: Likewise.
	* testsuite/experimental/any/typedefs.cc: Likewise.
	* testsuite/experimental/array/make_array.cc: Likewise.
	* testsuite/experimental/array/neg.cc: Likewise.
	* testsuite/experimental/chrono/value.cc: Likewise.
	* testsuite/experimental/deque/erasure.cc: Likewise.
	* testsuite/experimental/forward_list/erasure.cc: Likewise.
	* testsuite/experimental/list/erasure.cc: Likewise.
	* testsuite/experimental/map/erasure.cc: Likewise.
	* testsuite/experimental/memory/observer_ptr/assignment/assign.cc:
	Likewise.
	* testsuite/experimental/memory/observer_ptr/cons/cons.cc: Likewise.
	* testsuite/experimental/memory/observer_ptr/hash/hash.cc: Likewise.
	* testsuite/experimental/memory/observer_ptr/make_observer.cc:
	Likewise.
	* testsuite/experimental/memory/observer_ptr/relops/relops.cc:
	Likewise.
	* testsuite/experimental/memory/observer_ptr/requirements.cc: Likewise.
	* testsuite/experimental/memory/observer_ptr/swap/swap.cc: Likewise.
	* testsuite/experimental/memory/observer_ptr/typedefs.cc: Likewise.
	* testsuite/experimental/optional/77288.cc: Likewise.
	* testsuite/experimental/optional/assignment/1.cc: Likewise.
	* testsuite/experimental/optional/assignment/2.cc: Likewise.
	* testsuite/experimental/optional/assignment/3.cc: Likewise.
	* testsuite/experimental/optional/assignment/4.cc: Likewise.
	* testsuite/experimental/optional/assignment/5.cc: Likewise.
	* testsuite/experimental/optional/assignment/6.cc: Likewise.
	* testsuite/experimental/optional/cons/77727.cc: Likewise.
	* testsuite/experimental/optional/cons/move.cc: Likewise.
	* testsuite/experimental/optional/cons/value.cc: Likewise.
	* testsuite/experimental/optional/cons/value_neg.cc: Likewise.
	* testsuite/experimental/optional/constexpr/cons/value.cc: Likewise.
	* testsuite/experimental/optional/constexpr/make_optional.cc: Likewise.
	* testsuite/experimental/optional/constexpr/observers/1.cc: Likewise.
	* testsuite/experimental/optional/constexpr/observers/2.cc: Likewise.
	* testsuite/experimental/optional/constexpr/observers/3.cc: Likewise.
	* testsuite/experimental/optional/constexpr/observers/4.cc: Likewise.
	* testsuite/experimental/optional/constexpr/observers/5.cc: Likewise.
	* testsuite/experimental/optional/constexpr/relops/1.cc: Likewise.
	* testsuite/experimental/optional/constexpr/relops/2.cc: Likewise.
	* testsuite/experimental/optional/constexpr/relops/3.cc: Likewise.
	* testsuite/experimental/optional/constexpr/relops/4.cc: Likewise.
	* testsuite/experimental/optional/constexpr/relops/5.cc: Likewise.
	* testsuite/experimental/optional/constexpr/relops/6.cc: Likewise.
	* testsuite/experimental/optional/make_optional.cc: Likewise.
	* testsuite/experimental/optional/observers/1.cc: Likewise.
	* testsuite/experimental/optional/observers/2.cc: Likewise.
	* testsuite/experimental/optional/observers/3.cc: Likewise.
	* testsuite/experimental/optional/observers/4.cc: Likewise.
	* testsuite/experimental/optional/observers/5.cc: Likewise.
	* testsuite/experimental/optional/relops/1.cc: Likewise.
	* testsuite/experimental/optional/relops/2.cc: Likewise.
	* testsuite/experimental/optional/relops/3.cc: Likewise.
	* testsuite/experimental/optional/relops/4.cc: Likewise.
	* testsuite/experimental/optional/relops/5.cc: Likewise.
	* testsuite/experimental/optional/relops/6.cc: Likewise.
	* testsuite/experimental/optional/requirements.cc: Likewise.
	* testsuite/experimental/optional/swap/1.cc: Likewise.
	* testsuite/experimental/optional/typedefs.cc: Likewise.
	* testsuite/experimental/propagate_const/assignment/move.cc: Likewise.
	* testsuite/experimental/propagate_const/assignment/move_neg.cc:
	Likewise.
	* testsuite/experimental/propagate_const/cons/move.cc: Likewise.
	* testsuite/experimental/propagate_const/cons/move_neg.cc: Likewise.
	* testsuite/experimental/propagate_const/hash/1.cc: Likewise.
	* testsuite/experimental/propagate_const/observers/1.cc: Likewise.
	* testsuite/experimental/propagate_const/relops/1.cc: Likewise.
	* testsuite/experimental/propagate_const/requirements1.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/experimental/propagate_const/swap/1.cc: Likewise.
	* testsuite/experimental/propagate_const/typedefs.cc: Likewise.
	* testsuite/experimental/random/randint.cc: Likewise.
	* testsuite/experimental/ratio/value.cc: Likewise.
	* testsuite/experimental/set/erasure.cc: Likewise.
	* testsuite/experimental/string/erasure.cc: Likewise.
	* testsuite/experimental/string_view/typedefs.cc: Likewise.
	* testsuite/experimental/system_error/value.cc: Likewise.
	* testsuite/experimental/tuple/tuple_size.cc: Likewise.
	* testsuite/experimental/type_traits/value.cc: Likewise.
	* testsuite/experimental/unordered_map/erasure.cc: Likewise.
	* testsuite/experimental/unordered_set/erasure.cc: Likewise.
	* testsuite/experimental/vector/erasure.cc: Likewise.

From-SVN: r242417
2016-11-15 14:33:41 +00:00
Jonathan Wakely bf56b0b838 Add std::string constructor for substring of string_view (LWG 2742)
* doc/xml/manual/intro.xml: Document LWG 2742 status.
	* doc/html/*: Regenerate.
	* include/bits/basic_string.h
	(basic_string(const T&, size_type, size_type, const Allocator&)): Add
	constructor for substring of basic_string_view, as per LWG 2742 but
	with additional constraint to fix ambiguity.
	* testsuite/21_strings/basic_string/cons/char/9.cc: New test.
	* testsuite/21_strings/basic_string/cons/wchar_t/9.cc: New test.

From-SVN: r242416
2016-11-15 14:33:20 +00:00
Jonathan Wakely 8b99f005cb Constrain swap overload for std::optional (LWG 2748)
* doc/xml/manual/intro.xml: Document LWG 2748 status.
	* include/std/optional (optional<T>::swap): Use is_nothrow_swappable_v
	for exception specification.
	(swap(optional<T>&, optional<T>&)): Disable when T is not swappable.
	* testsuite/20_util/optional/swap/2.cc: New test.

From-SVN: r242415
2016-11-15 14:33:09 +00:00
Ville Voutilainen 6964bb3ed9 Implement P0513R0, Poisoning the Hash.
* include/bits/functional_hash.h (__poison_hash): New.
* include/bits/unique_ptr.h
(hash<unique_ptr<_Tp, _Dp>>): Derive from __poison_hash.
* include/std/optional (hash<optional<_Tp>>): Likewise.
* include/std/variant (hash<variant<_Types...>>): Likewise.
* testsuite/20_util/default_delete/48631_neg.cc: Adjust.
* testsuite/20_util/default_delete/void_neg.cc: Likewise.
* testsuite/20_util/optional/hash.cc: New.
* testsuite/20_util/unique_ptr/assign/48635_neg.cc: Adjust.
* testsuite/20_util/unique_ptr/cons/cv_qual_neg.cc: Adjust.
* testsuite/20_util/unique_ptr/hash/1.cc: Add tests for
poisoned fancy pointer hashes.
* testsuite/20_util/variant/hash.cc: New.

From-SVN: r242402
2016-11-14 23:22:53 +02:00
Ville Voutilainen 627a2f5923 Implement P0504R0 (Revisiting in-place tag types for any/optional/variant).
Implement P0504R0 (Revisiting in-place tag types for
any/optional/variant).
* include/std/any (any(_ValueType&& __value)): Constrain
the __is_in_place_type with the decayed type.
(make_any): Adjust to use the new tag type.
* include/std/utility (in_place_tag): Remove.
(in_place_t): Turn into a non-reference tag type.
(__in_place, __in_place_type, __in_place_index): Remove.
(in_place): Turn into an inline variable of non-reference
tag type.
(in_place<_Tp>): Remove.
(in_place_index<_Idx>): Remove.
(in_place_type_t): New.
(in_place_type): Turn into a variable template of non-reference
type.
(in_place_index_t): New.
(in_place_index): Turn into a variable template of non-reference
type.
* include/std/variant
(_Variant_storage(in_place_index_t<_Np>, _Args&&...)): Adjust to
use the new tag type.
(_Union(in_place_index_t<0>, _Args&&...)): Likewise.
(_Union(in_place_index_t<_Np>, _Args&&...)): Likewise.
(_Variant_base()): Likewise.
(variant(_Tp&&)): Likewise.
(variant(in_place_type_t<_Tp>, _Args&&...)): Likewise.
(variant(in_place_type_t<_Tp>, initializer_list<_Up>,
_Args&&...)): Likewise.
(variant(in_place_index_t<_Np>, _Args&&...)): Likewise.
(variant(in_place_index_t<_Np>, initializer_list<_Up>,
_Args&&...)): Likewise
(variant(allocator_arg_t, const _Alloc&)): Likewise.
(variant(allocator_arg_t, const _Alloc&, _Tp&&)): Likewise.
(variant(allocator_arg_t, const _Alloc&, in_place_type_t<_Tp>,
_Args&&...)): Likewise.
(variant(allocator_arg_t, const _Alloc&, in_place_type_t<_Tp>,
initializer_list<_Up>, _Args&&...)): Likewise.
(variant(allocator_arg_t, const _Alloc&, in_place_index_t<_Np>,
_Args&&...)): Likewise.
(variant(allocator_arg_t, const _Alloc&, in_place_index_t<_Np>,
initializer_list<_Up>, _Args&&...)): Likewise.
(emplace(_Args&&...)): Likewise.
(emplace(initializer_list<_Up>, _Args&&...)): Likewise.
* testsuite/20_util/any/cons/explicit.cc: Likewise.
* testsuite/20_util/any/cons/in_place.cc: Likewise.
* testsuite/20_util/any/requirements.cc: Add tests to
check that any is not constructible from the new in_place_type_t
of any value category.
* testsuite/20_util/in_place/requirements.cc: Adjust to
use the new tag type.
* testsuite/20_util/variant/compile.cc: Likewise.
* testsuite/20_util/variant/run.cc: Likewise.

From-SVN: r242401
2016-11-14 22:47:44 +02:00
Ville Voutilainen ca9e949f2e Use constexpr addressof in optional, SFINAE housekeeping for any, optional and tuple.
Use constexpr addressof in optional, SFINAE housekeeping
for any, optional and tuple.
* include/std/any (__do_emplace(_Args&&...)): New.
(__do_emplace(initializer_list<_Up>, _Args&&...)): Likewise.
(__any_constructible): Likewise.
(__any_constructible_t): Use __any_constructible.
(operator=(_ValueType&&)): SFINAE in the return type.
(emplace(_Args&&...)): Likewise.
(emplace(initializer_list<_Up>, _Args&&...)): Likewise.
* include/std/optional (_Has_addressof_mem): Remove.
(_Has_addressof_free): Likewise.
(_Has_addressof): Likewise.
(__constexpr_addressof(_Tp&)): Likewise.
(operator->): Use std::__addressof.
* include/std/tuple (operator=(const tuple<_UElements...>&)):
SFINAE in return type.
(operator=(tuple<_UElements...>&&)): Likewise.
* testsuite/20_util/any/misc/any_cast_neg.cc: Adjust.

From-SVN: r242390
2016-11-14 17:30:37 +02:00
Jason Merrill e7555e42d0 Improve various diagnostic issues.
* call.c (build_new_method_call_1): Include template arguments in
	error message.
	(print_error_for_call_failure): Likewise.
	(build_new_function_call): Pass them in.
	* name-lookup.c (supplement_binding_1): Don't complain about a
	conflict with an erroneous declaration.
	* error.c (dump_decl): Fix printing of alias declaration.
	* decl.c (make_typename_type): Call cxx_incomplete_type_error.
	* parser.c (cp_parser_diagnose_invalid_type_name): Likewise.
	* semantics.c (perform_koenig_lookup): Don't wrap an error in
	TEMPLATE_ID_EXPR.

From-SVN: r242376
2016-11-13 23:58:45 -05: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
Ville Voutilainen 1701800580 Implement P0403R1, Literal suffixes for basic_string_view.
* include/std/string_view
(operator""sv(const char*, size_t)): New.
(operator""sv(const wchar_t*, size_t)): Likewise.
(operator""sv(const char16_t*, size_t)): Likewise.
(operator""sv(const char32_t*, size_t)): Likewise.
* testsuite/21_strings/basic_string_view/literals/types.cc: New.
* testsuite/21_strings/basic_string_view/literals/values.cc: Likewise.
* testsuite/experimental/string_view/literals/values.cc: Add
tests for literals with embedded NULs.

From-SVN: r242367
2016-11-13 22:54:27 +02:00
Jason Merrill ba1e69c03f DR 374 - specialization in outer namespace
PR c++/56840
	* pt.c (check_specialization_namespace): Allow any enclosing
	namespace.
	(check_unqualified_spec_or_inst): New.
	(check_explicit_specialization): Call it.
	* parser.c (cp_parser_elaborated_type_specifier)
	(cp_parser_class_head): Call it.

From-SVN: r242348
2016-11-13 01:51:23 -05:00
Tim Shen 7ce69e5a71 regex.h (regex_iterator::regex_iterator()): Define end() as _M_pregex == nullptr.
* libstdc++-v3/include/bits/regex.h (regex_iterator::regex_iterator()):
	Define end() as _M_pregex == nullptr.
	* libstdc++-v3/include/bits/regex.tcc (regex_iterator::operator==(),
	regex_iterator::operator++()): Fix operator==() and operator++() to
	look at null-ness of _M_pregex on both sides.
	* testsuite/28_regex/regression.cc: New testcase.

From-SVN: r242025
2016-11-09 22:11:32 +00:00
Jason Merrill 51dc660315 Implement P0012R1, Make exception specifications part of the type system.
gcc/cp/
	* cp-tree.h (enum tsubst_flags): Add tf_fndecl_type.
	(flag_noexcept_type, ce_type): New.
	* call.c (build_conv): Add ck_fnptr.
	(enum conversion_kind): Change ck_tsafe to ck_fnptr.
	(convert_like_real): Likewise.
	(standard_conversion): Likewise.  Allow function pointer
	conversions for pointers to member functions.
	(reference_compatible_p): Allow function pointer conversions.
	(direct_reference_binding): Likewise.
	(reference_binding): Reference-compatible is no longer a subset of
	reference-related.
	(is_subseq): Also strip ck_lvalue after next_conversion.
	* class.c (instantiate_type): Check fnptr_conv_p.
	(resolve_address_of_overloaded_function): Likewise.
	* cvt.c (can_convert_tx_safety): Now static.
	(noexcept_conv_p, fnptr_conv_p, strip_fnptr_conv): New.
	* decl.c (flag_noexcept_type): Define.
	(cxx_init_decl_processing): Set it.
	(bad_specifiers): Check it.
	(grokdeclarator) [cdk_function]: Add exception-spec to type here.
	* lambda.c (maybe_add_lambda_conv_op): Add exception-spec to
	returned pointer.
	* mangle.c (struct globals): Add need_cxx1z_warning.
	(mangle_decl): Check it.
	(write_exception_spec): New.
	(write_function_type): Call it.
	(canonicalize_for_substitution): Handle exception spec.
	(write_type): Likewise.
	(write_encoding): Set processing_template_decl across mangling of
	partially-instantiated type.
	* pt.c (determine_specialization): Pass tf_fndecl_type.
	(tsubst_decl, fn_type_unification): Likewise.
	(tsubst): Strip tf_fndecl_type, pass it to
	tsubst_exception_specification.
	(convert_nontype_argument_function): Handle function pointer
	conversion.
	(convert_nontype_argument): Likewise.
	(unify, for_each_template_parm_r): Walk into noexcept-specifier.
	* rtti.c (ptr_initializer): Encode noexcept.
	* tree.c (canonical_eh_spec): New.
	(build_exception_variant): Use it.
	* typeck.c (composite_pointer_type): Handle fnptr conversion.
	(comp_except_specs): Compare canonical EH specs.
	(structural_comptypes): Call it.
gcc/c-family/
	* c.opt (Wc++1z-compat): New.
	* c-cppbuiltin.c (c_cpp_builtins): Add __cpp_noexcept_function_type.
libstdc++-v3/
	* include/bits/c++config (_GLIBCXX_NOEXCEPT_PARM)
	(_GLIBCXX_NOEXCEPT_QUAL): New.
	* include/std/type_traits (is_function): Use them.
	* libsubc++/new (launder): Likewise.
	* libsupc++/cxxabi.h (__pbase_type_info::__masks): Add
	__noexcept_mask.
	* libsupc++/pbase_type_info.cc (__do_catch): Handle function
	pointer conversion.
libiberty/
	* cp-demangle.c (is_fnqual_component_type): New.
	(d_encoding, d_print_comp_inner, d_print_mod_list): Use it.
	(FNQUAL_COMPONENT_CASE): New.
	(d_make_comp, has_return_type, d_print_comp_inner)
	(d_print_function_type): Use it.
	(next_is_type_qual): New.
	(d_cv_qualifiers, d_print_mod): Handle noexcept and throw-spec.
include/
	* demangle.h (enum demangle_component_type): Add
	DEMANGLE_COMPONENT_NOEXCEPT, DEMANGLE_COMPONENT_THROW_SPEC.

From-SVN: r241944
2016-11-07 18:09:29 -05: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 1f5700e952 Implement std::launder for C++17
* doc/xml/manual/status_cxx2017.xml: Update status.
	* doc/html/*: Regenerate.
	* include/std/type_traits (has_unique_object_representations): Guard
	with __has_builtin check.
	* libsupc++/new (launder): Define for C++17.
	* testsuite/18_support/launder/1.cc: New test.
	* testsuite/18_support/launder/requirements.cc: New test.
	* testsuite/18_support/launder/requirements_neg.cc: New test.

From-SVN: r241648
2016-10-28 15:09:33 +01:00
Jonathan Wakely e63d7e71a1 Fix target selectors in uniform_inside_sphere_distribution tests
* testsuite/ext/random/uniform_inside_sphere_distribution/cons/
	default.cc: Fix effective target selector.
	* testsuite/ext/random/uniform_inside_sphere_distribution/cons/
	parms.cc: Likewise.
	* testsuite/ext/random/uniform_inside_sphere_distribution/operators/
	equal.cc: Likewise.
	* testsuite/ext/random/uniform_inside_sphere_distribution/operators/
	generate.cc: Likewise.
	* testsuite/ext/random/uniform_inside_sphere_distribution/operators/
	inequal.cc: Likewise.
	* testsuite/ext/random/uniform_inside_sphere_distribution/operators/
	serialize.cc: Likewise.

From-SVN: r241621
2016-10-27 14:55:36 +01:00
Jonathan Wakely 69af1c04e0 Adjust precision of filesystem::last_write_time tests
* testsuite/experimental/filesystem/iterators/directory_iterator.cc:
	Use end() function to get end iterator.
	* testsuite/experimental/filesystem/iterators/pop.cc: Remove printf
	statements that were present for debugging.
	* testsuite/experimental/filesystem/iterators/
	recursive_directory_iterator.cc: Use end() function to get end
	iterator.
	* testsuite/experimental/filesystem/operations/last_write_time.cc:
	Only require file timestamps to be accurate to one second.

From-SVN: r241616
2016-10-27 12:01:49 +01:00
Jonathan Wakely 790207d645 Fix test for recursive_directory_iterator::pop
* testsuite/experimental/filesystem/iterators/pop.cc: Remove
	unreliable dependency on directory order.

From-SVN: r241583
2016-10-26 17:25:44 +01:00
Edward Smith-Rowland 10da5b7cbc Implement uniform_inside_sphere_distribution extension.
2016-10-26  Edward Smith-Rowland  <3dw4rd@verizon.net>

	Implement uniform_inside_sphere_distribution extension.
	* include/ext/random: Implement uniform_inside_sphere_distribution.
	* include/ext/random.tcc: Ditto.
	* testsuite/ext/random/uniform_inside_sphere_distribution/
	cons/default.cc: New.
	* testsuite/ext/random/uniform_inside_sphere_distribution/
	cons/parms.cc: New.
	* testsuite/ext/random/uniform_inside_sphere_distribution/
	operators/equal.cc: New.
	* testsuite/ext/random/uniform_inside_sphere_distribution/
	operators/generate.cc: New.
	* testsuite/ext/random/uniform_inside_sphere_distribution/
	operators/inequal.cc: New.
	* testsuite/ext/random/uniform_inside_sphere_distribution/
	operators/serialize.cc: New.

From-SVN: r241562
2016-10-26 15:34:18 +00: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
Jonathan Wakely b4e7e6bf22 Fix error handling in recursive_directory_iterator::increment
* src/filesystem/dir.cc (recursive_directory_iterator::increment):
	Reset state on error.
	* testsuite/experimental/filesystem/iterators/
	recursive_directory_iterator.cc: Check state after increment error.

From-SVN: r241552
2016-10-26 14:34:34 +01:00