gcc/libstdc++-v3/testsuite
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
..
17_intro
18_support
19_diagnostics
20_util Support move-only deleters in std::shared_ptr (LWG 2802) 2017-06-09 14:20:37 +01:00
21_strings Finish implementing P0426R1 "Constexpr for std::char_traits" for C++17 2017-06-12 22:22:39 +00:00
22_locale
23_containers stl_tree.h (_Rb_tree_impl()): Restore _Node_allocator default init. 2017-06-12 20:38:16 +00:00
24_iterators
25_algorithms PR libstdc++/80796 Add new std::search overload for C++17 2017-05-19 13:11:31 +01:00
26_numerics
27_io PR libstdc++/80624 satisfy invariant for char_traits<char16_t>::eof() 2017-06-02 19:35:37 +01:00
28_regex Add C++17 deduction guide for std::basic_regex (P0433R2, partial) 2017-06-07 16:43:54 +01:00
29_atomics
30_threads PR libstdc++/55917 do not handle exceptions in std::thread 2017-06-12 17:37:28 +01:00
abi
backward
config
data
decimal
experimental Test source_location::current() in default member initializer 2017-05-16 15:26:14 +01:00
ext
lib
libstdc++-abi
libstdc++-dg
libstdc++-prettyprinters
libstdc++-xmethods
performance
special_functions
tr1
tr2
util stl_tree.h (_Rb_tree_impl()): Restore _Node_allocator default init. 2017-06-12 20:38:16 +00:00
Makefile.am
Makefile.in