Rename __is_trivially_relocatable to __is_bitwise_relocatable.
[official-gcc.git] / libstdc++-v3 / ChangeLog
bloba3c0002d8bd7181768b95ca1c11a41f254e4fbba
1 2019-02-05  Marc Glisse  <marc.glisse@inria.fr>
3         PR libstdc++/87106
4         * include/bits/stl_uninitialized.h (__is_trivially_relocatable):
5         Rename...
6         (__is_bitwise_relocatable): ... to this.
7         (__relocate_a_1): Adapt.
8         * include/bits/stl_deque.h (__is_trivially_relocatable): Rename...
9         (__is_bitwise_relocatable): ... to this.
11 2019-01-30  Jonathan Wakely  <jwakely@redhat.com>
13         PR libstdc++/89117
14         * src/c++17/fs_path.cc (path::replace_extension): Erase extension from
15         final component as well as from _M_pathname. Append the dot using
16         operator+= instead of only to _M_pathname.
17         (path::_M_find_extension): Reformat slightly.
18         * testsuite/27_io/filesystem/path/modifiers/replace_extension.cc:
19         Add more test cases.
21 2019-01-30  Ulrich Drepper  <drepper@redhat.com>
23         * doc/xml/manual/status_cxx2020.xml: Update P0600 entry.
25 2019-01-29  Jonathan Wakely  <jwakely@redhat.com>
27         * testsuite/26_numerics/headers/complex/synopsis.cc: Remove incorrect
28         constexpr specifiers from arg and proj.
30         * config/abi/pre/gnu.ver (GLIBCXX_3.4.26): Add missing exports for
31         __shared_ptr instantiations used by gcc4-compatible ABI.
33         * include/experimental/forward_list (experimental::erase): Qualify
34         call to erase_if.
35         * include/experimental/list (experimental::erase): Likewise.
36         * include/std/forward_list (std::erase): Likewise.
37         * include/std/list (std::erase): Likewise.
39         * testsuite/20_util/reference_wrapper/result_type.cc: Disable for
40         C++2a.
41         * testsuite/20_util/reference_wrapper/typedefs-2.cc: Likewise.
42         * testsuite/20_util/reference_wrapper/typedefs-3.cc: Likewise.
43         * testsuite/20_util/reference_wrapper/typedefs.cc: Likewise.
44         * testsuite/30_threads/async/54297.cc: Suppress nodiscard warning.
45         * testsuite/ext/array_allocator/26875.cc: Likewise.
46         * testsuite/ext/pool_allocator/allocate_chunk.cc: Likewise.
47         * testsuite/util/replacement_memory_operators.h: Likewise.
48         * testsuite/util/testsuite_allocator.h: Likewise.
50         * include/std/memory_resource (__pool_resource::_M_unpooled): Use
51         normal mode vector, even for debug mode.
52         * include/std/vector [_GLIBCXX_DEBUG] (_GLIBCXX_STD_C::pmr::vector):
53         Define alias template for normal mode vector.
55 2019-01-28  Jonathan Wakely  <jwakely@redhat.com>
57         PR libstdc++/68737
58         * config/locale/generic/c_locale.h (__convert_from_v)
59         [_GLIBCXX_USE_C99_STDIO]: Also check _GLIBCXX_HAVE_BROKEN_VSNPRINTF.
60         * config/os/hpux/os_defines.h: Define _GLIBCXX_HAVE_BROKEN_VSNPRINTF.
61         * include/bits/locale_facets.tcc (num_put::_M_insert_float)
62         [_GLIBCXX_USE_C99_STDIO]: Also check _GLIBCXX_HAVE_BROKEN_VSNPRINTF.
64 2019-01-24  Jonathan Wakely  <jwakely@redhat.com>
66         PR libstdc++/88840
67         * include/bits/stl_vector.h (vector::__use_relocate): Replace static
68         data member with static member function _S_use_relocate().
69         * include/bits/vector.tcc (vector::reserve, vector::_M_realloc_insert)
70         (vector::_M_default_append): Use _S_use_relocate() instead of
71         __use_relocate.
73         * testsuite/27_io/filesystem/path/compare/strings.cc: Only compare
74         sign of results.
76 2019-01-22  Jonathan Wakely  <jwakely@redhat.com>
78         PR libstdc++/88740
79         * testsuite/util/testsuite_hooks.h [stderr] (VERIFY): Use fprintf to
80         write to stderr instead of using printf.
82 2019-01-21  Jakub Jelinek  <jakub@redhat.com>
84         PR libstdc++/86590
85         * include/bits/char_traits.h (__constant_string_p,
86         __constant_char_array_p): Use __builtin_is_constant_evaluated if
87         available.
89 2019-01-20  Ulrich Drepper  <drepper@redhat.com>
91         Implement C++20 P0600r1.
92         * include/backward/hash_map: Add nodiscard attribute to empty.
93         * include/backward/hash_set: Likewise.
94         * backward/hashtable.h: Likewise.
95         * include/bits/basic_string.h: Likewise.
96         * include/bits/forward_list.h: Likewise.
97         * include/bits/hashtable.h: Likewise.
98         * include/bits/regex.h: Likewise.
99         * include/bits/stl_deque.h: Likewise.
100         * include/bits/stl_list.h: Likewise.
101         * include/bits/stl_map.h: Likewise.
102         * include/bits/stl_multimap.h: Likewise.
103         * include/bits/stl_multiset.h: Likewise.
104         * include/bits/stl_queue.h: Likewise.
105         * include/bits/stl_set.h: Likewise.
106         * include/bits/stl_stack.h: Likewise.
107         * include/bits/stl_tree.h: Likewise.
108         * include/bits/stl_vector.h: Likewise.
109         * include/bits/unordered_map.h: Likewise.
110         * include/bits/unordered_set.h: Likewise.
111         * include/debug/array: Likewise.
112         * include/experimental/any: Likewise.
113         * include/experimental/bits/fs_path.h: Likewise.
114         * include/experimental/internet: Likewise.
115         * include/experimental/string_view: Likewise.
116         * include/ext/pb_ds/detail/bin_search_tree_/info_fn_imps.hpp:
117         Likewise.
118         * include/ext/pb_ds/detail/binary_heap_/binary_heap_.hpp:
119         Likewise.
120         * include/ext/pb_ds/detail/binary_heap_/info_fn_imps.hpp:
121         Likewise.
122         * include/ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp:
123         Likewise.
124         * include/ext/pb_ds/detail/cc_hash_table_map_/info_fn_imps.hpp:
125         Likewise.
126         * include/ext/pb_ds/detail/cc_hash_table_map_/size_fn_imps.hpp:
127         Likewise.
128         * include/ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp:
129         Likewise.
130         * include/ext/pb_ds/detail/gp_hash_table_map_/info_fn_imps.hpp:
131         Likewise.
132         * include/ext/pb_ds/detail/left_child_next_sibling_heap_/
133         info_fn_imps.hpp: Likewise.
134         * include/ext/pb_ds/detail/left_child_next_sibling_heap_/
135         left_child_next_sibling_heap_.hpp: Likewise.
136         * include/ext/pb_ds/detail/list_update_map_/info_fn_imps.hpp:
137         Likewise.
138         * include/ext/pb_ds/detail/list_update_map_/lu_map_.hpp:
139         Likewise.
140         * include/ext/pb_ds/detail/ov_tree_map_/info_fn_imps.hpp:
141         Likewise.
142         * include/ext/pb_ds/detail/ov_tree_map_/ov_tree_map_.hp:
143         Likewise.
144         * include/ext/pb_ds/detail/pat_trie_/info_fn_imps.hpp:
145         Likewise.
146         * include/ext/pb_ds/detail/pat_trie_/pat_trie_.hpp:
147         Likewise.
148         * include/ext/pb_ds/detail/rc_binomial_heap_/rc.hpp:
149         Likewise.
150         * include/ext/pb_ds/detail/tree_trace_base.hpp: Likewise.
151         * include/ext/pb_ds/trie_policy.hpp: Likewise.
152         * include/ext/rope: Likewise.
153         * include/ext/slist: Likewise.
154         * include/ext/vstring.h: Likewise.
155         * include/profile/array: Likewise.
156         * include/std/array: Likewise.
157         * include/tr1/array: Likewise.
158         * include/tr1/hashtable.h: Likewise.
159         * include/tr1/regex: Likewise.
160         * include/tr2/dynamic_bitset: Likewise.
161         * include/bits/alloc_traits.h: Add nodiscard attribute to
162         allocate.
163         * include/experimental/memory_resource: Likewise.
164         * include/ext/alloc_traits.h: Likewise.
165         * include/ext/array_allocator.h: Likewise.
166         * include/ext/bitmap_allocator.h: Likewise.
167         * include/ext/debug_allocator.h: Likewise.
168         * include/ext/extptr_allocator.h: Likewise.
169         * include/ext/mt_allocator.h: Likewise.
170         * include/ext/new_allocator.h: Likewise.
171         * include/ext/pool_allocator.h: Likewise.
172         * include/ext/throw_allocator.h: Likewise.
173         * include/std/scoped_allocator: Likewise.
174         * libsupc++/eh_alloc.cc: Likewise.
175         * include/std/future: Add nodiscard attribute to async.
176         * libsupc++/new: Add nodiscard attribute to new.
178 2019-01-18  Jonathan Wakely  <jwakely@redhat.com>
180         PR libstdc++/87514
181         PR libstdc++/87520
182         PR libstdc++/88782
183         * config/abi/pre/gnu.ver (GLIBCXX_3.4.26): Export new symbol.
184         * include/bits/shared_ptr.h
185         (shared_ptr(_Sp_make_shared_tag, const Alloc&, Args&&...))
186         (allocate_shared): Change to use new tag type.
187         * include/bits/shared_ptr_base.h (_Sp_make_shared_tag::_S_eq):
188         Declare new member function.
189         (_Sp_alloc_shared_tag): Define new type.
190         (_Sp_counted_ptr_inplace): Declare __shared_count<_Lp> as a friend.
191         (_Sp_counted_ptr_inplace::_M_get_deleter) [!__cpp_rtti]: Use
192         _Sp_make_shared_tag::_S_eq to check type_info.
193         (__shared_count(Ptr, Deleter),__shared_count(Ptr, Deleter, Alloc)):
194         Constrain to prevent being called with _Sp_alloc_shared_tag.
195         (__shared_count(_Sp_make_shared_tag, const _Alloc&, Args&&...)):
196         Replace constructor with ...
197         (__shared_count(Tp*&, _Sp_alloc_shared_tag<_Alloc>, Args&&...)): Use
198         reference parameter so address of the new object can be returned to
199         the caller. Obtain the allocator from the tag type.
200         (__shared_ptr(_Sp_make_shared_tag, const Alloc&, Args&&...)): Replace
201         constructor with ...
202         (__shared_ptr(_Sp_alloc_shared_tag<Alloc>, Args&&...)): Pass _M_ptr
203         to the __shared_count constructor.
204         (__allocate_shared): Change to use new tag type.
205         * src/c++11/shared_ptr.cc (_Sp_make_shared_tag::_S_eq): Define.
207 2019-01-17  Jonathan Wakely  <jwakely@redhat.com>
209         * src/c++17/fs_ops.cc
210         (equivalent(const path&, const path&, error_code&))
211         [_GLIBCXX_FILESYSTEM_IS_WINDOWS]: Use GetFileInformationByHandle to
212         compare files instead of relying on incomplete info returned by stat.
214         PR libstdc++/88884
215         * src/c++17/fs_ops.cc (absolute(const path&, error_code&)): Do nothing
216         if the path is already absolute.
217         [_GLIBCXX_FILESYSTEM_IS_WINDOWS]: Normalize root-directory.
218         [!_GLIBCXX_FILESYSTEM_IS_WINDOWS]: Pass error_code to current_path.
220         PR libstdc++/88881
221         * src/c++17/fs_ops.cc (canonical(const path&, error_code&))
222         [_GLIBCXX_FILESYSTEM_IS_WINDOWS]: Normalize path, to match behaviour
223         of filesystem::exists.
224         (create_directories(const path&, error_code&)): Add assertions.
225         (status(const path&, error_code&)) [_GLIBCXX_FILESYSTEM_IS_WINDOWS]:
226         Add workaround for bug in _wstat for paths with trailing slash.
227         * testsuite/27_io/filesystem/operations/create_directories.cc: Adjust
228         for expected behaviour on mingw.
229         * testsuite/experimental/filesystem/operations/create_directories.cc:
230         Likewise.
231         * testsuite/27_io/filesystem/operations/temp_directory_path.cc: Use
232         "TMP" instead of "TMPDIR" and clean environment before each test. Do
233         not test permissions on mingw targets.
235 2019-01-16  Jonathan Wakely  <jwakely@redhat.com>
237         * config/abi/pre/gnu.ver (GLIBCXX_3.4.26): Add exports for fstream
238         constructors and open members taking wide strings. Fix patterns for
239         filesystem::path members to match wstring_view parameters. Add
240         exports for shared_ptr members used by directory iterators.
241         * src/c++17/fs_ops.cc (remove(const path&, error_code&)): Clear the
242         error code parameter if the file doesn't exist.
243         * src/filesystem/ops.cc (remove(const path&, error_code&)):
244         Likewise.
245         * testsuite/27_io/filesystem/operations/canonical.cc: Fix expected
246         values for mingw targets, where "/" is not an absolute path. Do not
247         test symlinks on mingw targets.
248         * testsuite/experimental/filesystem/operations/canonical.cc: Likewise.
249         * testsuite/27_io/filesystem/operations/copy.cc: Do not test symlinks
250         on mingw targets.
251         * testsuite/experimental/filesystem/operations/copy.cc: Likewise.
252         * testsuite/27_io/filesystem/operations/create_directories.cc: Check
253         that each component of the path is created.
254         * testsuite/experimental/filesystem/operations/create_directories.cc:
255         Likewise.
256         * testsuite/27_io/filesystem/operations/exists.cc: Do not test
257         permissions on mingw targets.
258         * testsuite/experimental/filesystem/operations/exists.cc: Likewise.
259         * testsuite/27_io/filesystem/operations/is_empty.cc: Likewise.
260         * testsuite/experimental/filesystem/operations/is_empty.cc: Likewise.
261         * testsuite/27_io/filesystem/operations/permissions.cc: XFAIL for
262         mingw targets.
263         * testsuite/experimental/filesystem/operations/permissions.cc:
264         Likewise.
265         * testsuite/27_io/filesystem/operations/remove.cc: Do not test
266         symlinks or permissions on mingw targets.
267         * testsuite/experimental/filesystem/operations/remove.cc: Likewise.
268         * testsuite/27_io/filesystem/operations/remove_all.cc: Do not test
269         symlinks on mingw targets.
270         * testsuite/experimental/filesystem/operations/remove_all.cc:
271         Likewise.
272         * testsuite/27_io/filesystem/operations/status.cc: Do not test
273         permissions on mingw targets.
274         * testsuite/27_io/filesystem/operations/weakly_canonical.cc: Do not
275         test symlinks on mingw targets.
276         * testsuite/experimental/filesystem/operations/space.cc: Fix test
277         for mingw targets.
279 2019-02-14  Ulrich Drepper  <drepper@redhat.com>
281         PR libstdc++/88738
282         Warn about unused comparisons of shared_ptr/unique_ptr
283         * include/bits/c++config [_GLIBCXX_NODISCARD]: Define.
284         * include/bits/shared_ptr.h: Use it for operator ==, !=,
285         <, <=, >, >= for shared_ptr.
286         * include/bits/unique_ptr.h: Likewise for unique_ptr.
288 2019-01-15  Jonathan Wakely  <jwakely@redhat.com>
290         * include/bits/shared_ptr_base.h (__cpp_lib_shared_ptr_arrays): Define
291         as 201611L, because P0497R0 changes are supported.
292         * include/std/version (__cpp_lib_shared_ptr_arrays): Likewise.
294         * include/bits/erase_if.h [__cplusplus > 201703L]
295         (__cpp_lib_erase_if): Only define for C++2a.
296         * include/std/iterator [__cplusplus >= 201402L && !_GLIBCXX_DEBUG]
297         (__cpp_lib_null_iterators): Define.
298         * include/std/version [__cplusplus >= 201402L && !_GLIBCXX_DEBUG]
299         (__cpp_lib_null_iterators): Define.
300         [__cpp_impl_destroying_delete] (__cpp_lib_destroying_delete): Define.
302         * doc/xml/manual/status_cxx2017.xml: Document P0032R3 and P0307R2
303         status.
304         * include/bits/stl_uninitialized.h (__cpp_lib_raw_memory_algorithms):
305         Define.
306         * include/std/any (__cpp_lib_any): Define as 201606L, because P0032R3
307         changes are supported.
308         * include/std/optional (__cpp_lib_optional): Likewise.
309         * include/std/variant (__cpp_lib_variant): Likewise.
310         * include/std/version [!__STRICT_ANSI__]
311         (__cpp_lib_uncaught_exceptions): Define as long integer.
312         [__cplusplus >= 201703L] (__cpp_lib_any)
313         (__cpp_lib_raw_memory_algorithms, __cpp_lib_uncaught_exceptions)
314         (__cpp_lib_variant): Define for C++17.
315         [__cplusplus >= 201703L] (__cpp_lib_optional): Update value and define
316         as long integer.
317         * libsupc++/exception (__cpp_lib_uncaught_exceptions): Define as long
318         integer.
320         * doc/xml/manual/status_cxx2020.xml: Update P1123R0 status.
322 2019-01-12  Jonathan Wakely  <jwakely@redhat.com>
324         PR libstdc++/88811
325         PR libstdc++/83306
326         * src/filesystem/path.cc: Fix typo. If first path is empty, show []
327         before second path.
328         * testsuite/experimental/filesystem/filesystem_error/cons.cc: New
329         test.
331 2019-01-11  Jonathan Wakely  <jwakely@redhat.com>
333         * doc/xml/manual/intro.xml: Include new section.
334         * doc/xml/manual/status_cxx2017.xml: Document more
335         implementation-defined properties of the library.
336         * doc/xml/manual/status_cxx2020.xml: Document C++2a status.
337         * doc/html/*: Regenerate.
339         * include/bits/refwrap.h [__cplusplus > 201703L]
340         (_Refwrap_base_arg1, _Refwrap_base_arg2, _Reference_wrapper_base)
341         (_Reference_wrapper_base_memfun): Do not define for C++2a.
342         (reference_wrapper): Do not derive from _Reference_wrapper_base_memfun
343         for C++2a.
344         (reference_wrapper::operator()): Add static assertion.
345         * testsuite/20_util/reference_wrapper/incomplete.cc: New test.
347         * include/std/chrono (duration_values::zero(), duration_values::min())
348         (duration_values::max()): Add noexcept.
349         (duration::zero(), duration::min(), duration::max()): Likewise.
350         (time_point::zero(), time_point::min(), time_point::max()): Likewise.
351         * testsuite/20_util/duration/requirements/noexcept.cc: New test.
352         * testsuite/20_util/time_point/requirements/noexcept.cc: New test.
354         * include/std/version (__cpp_lib_erase_if): Move to C++20 group.
356 2019-01-11  Jakub Jelinek  <jakub@redhat.com>
358         * include/std/type_traits (__cpp_lib_is_constant_evaluated): Define.
359         * include/std/version (__cpp_lib_is_constant_evaluated): Define.
361 2019-01-11  Jonathan Wakely  <jwakely@redhat.com>
363         PR libstdc++/88802
364         * include/bits/functional_hash.h (hash<nullptr_t>): Define
365         specialization for C++17 (P0513R0, LWG 2817).
366         * testsuite/20_util/hash/nullptr.cc: New test.
368         PR libstdc++/88125
369         * config/abi/pre/gnu.ver (GLIBCXX_3.4.6): Remove unused duplicate
370         pattern for std::basic_stringbuf::str().
372         * config/abi/pre/gnu.ver (GLIBCXX_3.4): Correct recent changes to
373         basic_ostream::operator<< patterns.
375 2019-01-10  Jonathan Wakely  <jwakely@redhat.com>
377         * testsuite/27_io/filesystem/operations/last_write_time.cc: Fix
378         test failures on targets with 32-bit time_t.
380         * include/bits/erase_if.h: Define __cpp_lib_erase_if.
381         * include/std/deque: Likewise.
382         * include/std/forward_list: Likewise.
383         * include/std/list: Likewise.
384         * include/std/string: Likewise.
385         * include/std/vector: Likewise.
386         * include/std/version: Likewise.
387         * testsuite/21_strings/basic_string/erasure.cc: Test macro.
388         * testsuite/23_containers/deque/erasure.cc: Likewise.
389         * testsuite/23_containers/forward_list/erasure.cc: Likewise.
390         * testsuite/23_containers/list/erasure.cc: Likewise.
391         * testsuite/23_containers/map/erasure.cc: Likewise.
392         * testsuite/23_containers/set/erasure.cc: Likewise.
393         * testsuite/23_containers/unordered_map/erasure.cc: Likewise.
394         * testsuite/23_containers/unordered_set/erasure.cc: Likewise.
395         * testsuite/23_containers/vector/erasure.cc: Likewise.
397         * include/experimental/internet [AI_NUMERICSERV]
398         (resolver_base::numeric_service): Define conditionally.
399         * testsuite/experimental/net/internet/resolver/base.cc: Test it
400         conditionally.
401         * testsuite/experimental/net/internet/resolver/ops/lookup.cc:
402         Likewise.
404 2019-01-10  Ville Voutilainen  <ville.voutilainen@gmail.com>
405             Jonathan Wakely  <jwakely@redhat.com>
407         Implement LWG 2221
408         * config/abi/pre/gnu.ver (GLIBCXX_3.4): Tighten patterns.
409         (GLIBCXX_3.4.26): Add new exports.
410         * include/Makefile.am: Add ostream-inst.cc. Move string-inst.cc to
411         correct list of sources.
412         * include/Makefile.in: Regenerate.
413         * include/std/ostream (operator<<(nullptr_t)): New member function.
414         * src/c++17/ostream-inst.cc: New file.
415         * testsuite/27_io/basic_ostream/inserters_other/char/lwg2221.cc: New
416         test.
418 2019-01-10  Jonathan Wakely  <jwakely@redhat.com>
420         * testsuite/util/testsuite_fs.h (nonexistent_path): Include name
421         of the source file containing the caller.
422         * testsuite/27_io/filesystem/iterators/directory_iterator.cc: Remove
423         directories created by test.
424         * testsuite/27_io/filesystem/iterators/recursive_directory_iterator.cc:
425         Likewise.
426         * testsuite/experimental/filesystem/iterators/directory_iterator.cc:
427         Likewise.
428         * testsuite/experimental/filesystem/iterators/
429         recursive_directory_iterator.cc: Likewise.
431 2019-01-10  Jakub Jelinek  <jakub@redhat.com>
433         PR tree-optimization/88775
434         * include/bits/stl_function.h (greater<_Tp*>::operator(),
435         less<_Tp*>::operator(), greater_equal<_Tp*>::operator(),
436         less_equal<_Tp*>::operator()): Use __builtin_is_constant_evaluated
437         instead of __builtin_constant_p if available.  Don't bother with
438         the pointer comparison in C++11 and earlier.
440 2019-01-09  Sandra Loosemore  <sandra@codesourcery.com>
442         PR other/16615
444         * include/ext/bitmap_allocator.h: Mechanically replace "can not"
445         with "cannot".
447 2019-01-09  Jonathan Wakely  <jwakely@redhat.com>
449         * testsuite/libstdc++-prettyprinters/cxx17.cc: Fix expected output
450         for filesystem::path. Give variables more distinctive names.
452         * include/std/optional (_Optional_payload_base::_M_copy_assign): New
453         member function to perform non-trivial assignment.
454         (_Optional_payload_base::_M_move_assign): Likewise.
455         (_Optional_payload<T, true, false, true>::operator=)
456         (_Optional_payload<T, true, true, false>::operator=)
457         (_Optional_payload<T, true, false, false>::operator=): Call
458         _M_copy_assign and/or _M_move_assign to do non-trivial assignments.
460         PR libstdc++/88204
461         * testsuite/26_numerics/complex/operators/more_constexpr.cc: Do not
462         test std::complex<long double> if long double format is IBM128.
463         * testsuite/26_numerics/complex/requirements/more_constexpr.cc:
464         Likewise.
466 2019-01-08  Jonathan Wakely  <jwakely@redhat.com>
468         * testsuite/libstdc++-prettyprinters/compat.cc: Test printer support
469         for old std::unique_ptr layout.
470         * testsuite/libstdc++-prettyprinters/cxx17.cc: Fix std::variant test
471         to become valueless. Add filesystem::path tests.
473         PR libstdc++/87855
474         * include/std/optional (_Optional_payload_base): New class template
475         for common code hoisted from _Optional_payload specializations. Use
476         a template for the union, to allow a partial specialization for
477         types with non-trivial destructors. Add constructors for in-place
478         initialization to the union.
479         (_Optional_payload(bool, const _Optional_payload&)): Use _M_construct
480         to perform non-trivial copy construction, instead of relying on
481         non-standard copy elision in a delegating constructor.
482         (_Optional_payload(bool, _Optional_payload&&)): Likewise for
483         non-trivial move construction.
484         (_Optional_payload): Derive from _Optional_payload_base and use it
485         for everything except the non-trivial assignment operators, which are
486         defined as needed.
487         (_Optional_payload<false, C, M>): Derive from the specialization
488         _Optional_payload<true, false, false> and add a destructor.
489         (_Optional_base_impl::_M_destruct, _Optional_base_impl::_M_reset):
490         Forward to corresponding members of _Optional_payload.
491         (_Optional_base_impl::_M_is_engaged, _Optional_base_impl::_M_get):
492         Hoist common members from _Optional_base.
493         (_Optional_base): Make all members and base class public.
494         (_Optional_base::_M_get, _Optional_base::_M_is_engaged): Move to
495         _Optional_base_impl.
496         * python/libstdcxx/v6/printers.py (StdExpOptionalPrinter): Add
497         support for new std::optional layout.
498         * testsuite/libstdc++-prettyprinters/compat.cc: New test.
500         PR libstdc++/88066
501         * include/bits/locale_conv.h: Use <> for includes not "".
502         * include/ext/random: Likewise.
503         * include/ext/vstring.h: Likewise.
505 2019-01-08  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
507         * config/abi/pre/gnu.ver (GLIBCXX_3.4): Tighten existing patterns.
508         (GLIBCXX_3.4.21): Likewise.
510 2019-01-08  Jonathan Wakely  <jwakely@redhat.com>
512         PR libstdc++/88749
513         * src/filesystem/ops.cc (last_write_time): Fix preprocessor condition
514         to match the one that controls whether utimbuf and utime are declared.
516 2019-01-07  Jonathan Wakely  <jwakely@redhat.com>
518         PR libstdc++/87787
519         * include/bits/char_traits.h (char_traits::move): Do not pass null
520         pointers to memmove.
521         * include/bits/locale_facets.h
522         (ctype<char>::widen(const char*, const char*, char*)): Do not
523         pass null pointers to memcpy.
524         (ctype<char>::narrow(const char*, const char*, char, char*)):
525         Likewise.
526         (ctype<char>::do_widen(const char*, const char*, char*)):
527         Likewise.
528         (ctype<char>::do_narrow(const char*, const char*, char, char*)):
529         Likewise.
531         * doc/xml/manual/spine.xml: Update copyright years.
532         * doc/xml/manual/status_cxx2017.xml: Adjust note about -lstdc++fs.
533         * doc/xml/manual/using.xml: Remove requirement to link with -lstdc++fs
534         for C++17 filesystem library.
535         * doc/html/*: Regenerate.
537         * acinclude.m4 (GLIBCXX_CHECK_FILESYSTEM_DEPS): Check for truncate.
538         * config.h.in: Regenerate.
539         * config/abi/pre/gnu.ver: Order patterns for filesystem operations
540         alphabetically and add missing entries for copy_symlink,
541         hard_link_count, rename, and resize_file.
542         * configure: Regenerate.
543         * src/c++17/fs_ops.cc (resize_file): Remove #if so posix::truncate is
544         used unconditionally.
545         * src/filesystem/ops-common.h (__gnu_posix::truncate)
546         [!_GLIBCXX_HAVE_TRUNCATE]: Provide fallback definition that only
547         supports truncating to zero length.
548         * testsuite/27_io/filesystem/operations/all.cc: New test.
549         * testsuite/27_io/filesystem/operations/resize_file.cc: New test.
551 2019-01-06  Jonathan Wakely  <jwakely@redhat.com>
553         PR libstdc++/86756
554         * acinclude.m4 (GLIBCXX_CHECK_FILESYSTEM_DEPS): Check for utime and
555         lstat and define _GLIBCXX_USE_UTIME and _GLIBCXX_USE_LSTAT.
556         * config.h.in: Regenerate.
557         * config/abi/pre/gnu.ver (GLIBCXX_3.4.26): Export symbols for
558         remaining std::filesystem types and functions.
559         * configure: Regenerate.
560         * src/c++17/Makefile.am: Add C++17 filesystem sources.
561         * src/c++17/Makefile.in: Regenerate.
562         * src/c++17/cow-fs_dir.cc: Move src/filesystem/cow-std-dir.cc to
563         here, and change name of included file.
564         * src/c++17/cow-fs_ops.cc: Move src/filesystem/cow-std-ops.cc to
565         here, and change name of included file.
566         * src/c++17/fs_dir.cc: Move src/filesystem/std-dir.cc to here. Change
567         path to dir-common.h.
568         * src/c++17/fs_ops.cc: Move src/filesystem/std-ops.cc to here. Change
569         path to ops-common.h. Disable -Wunused-parameter warnings.
570         (internal_file_clock): Define unconditionally.
571         [!_GLIBCXX_HAVE_SYS_STAT_H] (internal_file_clock::from_stat): Do not
572         define.
573         (do_copy_file, do_space): Move definitions to ops.common.h.
574         (copy, file_size, hard_link_count, last_write_time, space): Only
575         perform operation when _GLIBCXX_HAVE_SYS_STAT_H is defined, otherwise
576         report an error.
577         (last_write_time, read_symlink): Remove unused attributes from
578         parameters.
579         * src/filesystem/Makefile.am: Remove C++17 filesystem sources.
580         * src/filesystem/Makefile.in: Regenerate.
581         * src/filesystem/cow-std-dir.cc: Move to src/c++17/cow-fs_dir.cc.
582         * src/filesystem/cow-std-ops.cc: Move to src/c++17/cow-fs_ops.cc.
583         * src/filesystem/std-dir.cc: Move to src/c++17/fs_dir.cc.
584         * src/filesystem/std-ops.cc: Move to src/c++17/fs_ops.cc.
585         * src/filesystem/dir-common.h [!_GLIBCXX_HAVE_DIRENT_H]: Define
586         dummy types and functions instead of using #error.
587         * src/filesystem/dir.cc [!_GLIBCXX_HAVE_DIRENT_H]: Use #error.
588         * src/filesystem/ops-common.h [!_GLIBCXX_USE_LSTAT] (lstat): Define
589         in terms of stat.
590         [!_GLIBCXX_HAVE_UNISTD_H]: Define dummy types and functions.
591         (do_copy_file, do_space): Move definitions here from std-ops.cc.
592         * src/filesystem/ops.cc: Adjust calls to do_copy_file and do_space
593         to account for new namespace.
594         * testsuite/27_io/filesystem/directory_entry/86597.cc: Remove
595         -lstdc++fs from dg-options.
596         * testsuite/27_io/filesystem/directory_entry/lwg3171.cc: Likewise.
597         * testsuite/27_io/filesystem/file_status/1.cc: Likewise.
598         * testsuite/27_io/filesystem/filesystem_error/cons.cc: Likewise.
599         * testsuite/27_io/filesystem/filesystem_error/copy.cc: Likewise.
600         * testsuite/27_io/filesystem/iterators/directory_iterator.cc:
601         Likewise.
602         * testsuite/27_io/filesystem/iterators/pop.cc: Likewise.
603         * testsuite/27_io/filesystem/iterators/recursive_directory_iterator.cc:
604         Likewise.
605         * testsuite/27_io/filesystem/operations/absolute.cc: Likewise.
606         * testsuite/27_io/filesystem/operations/canonical.cc: Likewise.
607         * testsuite/27_io/filesystem/operations/copy.cc: Likewise.
608         * testsuite/27_io/filesystem/operations/copy_file.cc: Likewise.
609         * testsuite/27_io/filesystem/operations/create_directories.cc:
610         Likewise.
611         * testsuite/27_io/filesystem/operations/create_directory.cc: Likewise.
612         * testsuite/27_io/filesystem/operations/create_symlink.cc: Likewise.
613         * testsuite/27_io/filesystem/operations/current_path.cc: Likewise.
614         * testsuite/27_io/filesystem/operations/equivalent.cc: Likewise.
615         * testsuite/27_io/filesystem/operations/exists.cc: Likewise.
616         * testsuite/27_io/filesystem/operations/file_size.cc: Likewise.
617         * testsuite/27_io/filesystem/operations/is_empty.cc: Likewise.
618         * testsuite/27_io/filesystem/operations/last_write_time.cc: Likewise.
619         * testsuite/27_io/filesystem/operations/permissions.cc: Likewise.
620         * testsuite/27_io/filesystem/operations/proximate.cc: Likewise.
621         * testsuite/27_io/filesystem/operations/read_symlink.cc: Likewise.
622         * testsuite/27_io/filesystem/operations/relative.cc: Likewise.
623         * testsuite/27_io/filesystem/operations/remove.cc: Likewise.
624         * testsuite/27_io/filesystem/operations/remove_all.cc: Likewise.
625         * testsuite/27_io/filesystem/operations/space.cc: Likewise.
626         * testsuite/27_io/filesystem/operations/status.cc: Likewise.
627         * testsuite/27_io/filesystem/operations/symlink_status.cc: Likewise.
628         * testsuite/27_io/filesystem/operations/temp_directory_path.cc:
629         Likewise.
630         * testsuite/27_io/filesystem/operations/weakly_canonical.cc: Likewise.
633         PR libstdc++/86756
634         * config/abi/pre/gnu.ver (GLIBCXX_3.4): Make various patterns for
635         typeinfo and vtables less greedy.
636         (GLIBCXX_3.4.26): Export symbols for std::filesystem::path.
637         * src/c++17/Makefile.am: Add fs_path.cc and cow-fs_path.cc.
638         * src/c++17/Makefile.in: Regenerate.
639         * src/c++17/cow-fs_path.cc: Move src/filesystem/cow-std-path.cc to
640         here, and change name of included file.
641         * src/c++17/fs_path.cc: Move src/filesystem/std-path.cc to here.
642         * src/filesystem/Makefile.am: Remove std-path.cc and cow-std-path.cc
643         from sources.
644         * src/filesystem/Makefile.in: Regenerate.
645         * src/filesystem/cow-std-path.cc: Move to src/c++17/cow-fs_path.cc.
646         * src/filesystem/std-path.cc: Move to src/c++17/fs_path.cc.
647         * testsuite/27_io/filesystem/path/append/path.cc: Remove -lstdc++fs
648         from dg-options and remove dg-require-filesystem-ts.
649         * testsuite/27_io/filesystem/path/append/source.cc: Likewise.
650         * testsuite/27_io/filesystem/path/assign/assign.cc: Likewise.
651         * testsuite/27_io/filesystem/path/assign/copy.cc: Likewise.
652         * testsuite/27_io/filesystem/path/compare/compare.cc: Likewise.
653         * testsuite/27_io/filesystem/path/compare/lwg2936.cc: Likewise.
654         * testsuite/27_io/filesystem/path/compare/path.cc: Likewise.
655         * testsuite/27_io/filesystem/path/compare/strings.cc: Likewise.
656         * testsuite/27_io/filesystem/path/concat/path.cc: Likewise.
657         * testsuite/27_io/filesystem/path/concat/strings.cc: Likewise.
658         * testsuite/27_io/filesystem/path/construct/80762.cc: Likewise.
659         * testsuite/27_io/filesystem/path/construct/copy.cc: Likewise.
660         * testsuite/27_io/filesystem/path/construct/default.cc: Likewise.
661         * testsuite/27_io/filesystem/path/construct/format.cc: Likewise.
662         * testsuite/27_io/filesystem/path/construct/locale.cc: Likewise.
663         * testsuite/27_io/filesystem/path/construct/range.cc: Likewise.
664         * testsuite/27_io/filesystem/path/construct/string_view.cc: Likewise.
665         * testsuite/27_io/filesystem/path/decompose/extension.cc: Likewise.
666         * testsuite/27_io/filesystem/path/decompose/filename.cc: Likewise.
667         * testsuite/27_io/filesystem/path/decompose/parent_path.cc: Likewise.
668         * testsuite/27_io/filesystem/path/decompose/relative_path.cc: Likewise.
669         * testsuite/27_io/filesystem/path/decompose/root_directory.cc:
670         Likewise.
671         * testsuite/27_io/filesystem/path/decompose/root_name.cc: Likewise.
672         * testsuite/27_io/filesystem/path/decompose/root_path.cc: Likewise.
673         * testsuite/27_io/filesystem/path/decompose/stem.cc: Likewise.
674         * testsuite/27_io/filesystem/path/generation/normal.cc: Likewise.
675         * testsuite/27_io/filesystem/path/generation/normal2.cc: Likewise.
676         * testsuite/27_io/filesystem/path/generation/proximate.cc: Likewise.
677         * testsuite/27_io/filesystem/path/generation/relative.cc: Likewise.
678         * testsuite/27_io/filesystem/path/generic/generic_string.cc: Likewise.
679         * testsuite/27_io/filesystem/path/itr/components.cc: Likewise.
680         * testsuite/27_io/filesystem/path/itr/traversal.cc: Likewise.
681         * testsuite/27_io/filesystem/path/modifiers/clear.cc: Likewise.
682         * testsuite/27_io/filesystem/path/modifiers/make_preferred.cc:
683         Likewise.
684         * testsuite/27_io/filesystem/path/modifiers/remove_filename.cc:
685         Likewise.
686         * testsuite/27_io/filesystem/path/modifiers/replace_extension.cc:
687         Likewise.
688         * testsuite/27_io/filesystem/path/modifiers/replace_filename.cc:
689         Likewise.
690         * testsuite/27_io/filesystem/path/modifiers/swap.cc: Likewise.
691         * testsuite/27_io/filesystem/path/native/string.cc: Likewise.
692         * testsuite/27_io/filesystem/path/nonmember/append.cc: Likewise.
693         * testsuite/27_io/filesystem/path/nonmember/hash_value.cc: Likewise.
694         * testsuite/27_io/filesystem/path/query/empty.cc: Likewise.
695         * testsuite/27_io/filesystem/path/query/has_extension.cc: Likewise.
696         * testsuite/27_io/filesystem/path/query/has_filename.cc: Likewise.
697         * testsuite/27_io/filesystem/path/query/has_parent_path.cc: Likewise.
698         * testsuite/27_io/filesystem/path/query/has_relative_path.cc: Likewise.
699         * testsuite/27_io/filesystem/path/query/has_root_directory.cc:
700         Likewise.
701         * testsuite/27_io/filesystem/path/query/has_root_name.cc: Likewise.
702         * testsuite/27_io/filesystem/path/query/has_root_path.cc: Likewise.
703         * testsuite/27_io/filesystem/path/query/has_stem.cc: Likewise.
704         * testsuite/27_io/filesystem/path/query/is_absolute.cc: Likewise.
705         * testsuite/27_io/filesystem/path/query/is_relative.cc: Likewise.
707         PR libstdc++/87431
708         * include/std/variant (_Variant_storage<true, _Types...>::_M_valid):
709         Check is_trivially_copyable instead of is_scalar.
710         (variant::emplace<N, Args>(Args&&...)): If construction of the new
711         contained value can throw and its type is trivially copyable then
712         construct into a temporary variant and move from it, to provide the
713         strong exception safety guarantee.
714         (variant::emplace<N, U, Args>(initializer_list<U>, Args&&...)):
715         Likewise.
716         * testsuite/20_util/variant/87431.cc: New test.
717         * testsuite/20_util/variant/run.cc: Adjust test so that throwing
718         conversion causes valueless state.
720         PR libstdc++/88607
721         * testsuite/17_intro/headers/c++1998/charset.cc: New test.
722         * testsuite/17_intro/headers/c++2011/charset.cc: New test.
723         * testsuite/17_intro/headers/c++2014/charset.cc: New test.
724         * testsuite/17_intro/headers/c++2017/charset.cc: New test.
725         * testsuite/17_intro/headers/c++2020/charset.cc: New test.
727 2019-01-05  Jonathan Wakely  <jwakely@redhat.com>
729         * include/bits/fs_fwd.h (__file_clock): Define new clock.
730         (file_time_type): Redefine in terms of __file_clock.
731         * src/filesystem/ops-common.h (file_time): Add FIXME comment about
732         overflow.
733         * src/filesystem/std-ops.cc (is_set(perm_options, perm_options)): Give
734         internal linkage.
735         (internal_file_lock): New helper type for accessing __file_clock.
736         (do_copy_file): Use internal_file_lock to convert system time to
737         file_time_type.
738         (last_write_time(const path&, error_code&)): Likewise.
739         (last_write_time(const path&, file_time_type, error_code&)): Likewise.
741 2019-01-04  Jonathan Wakely  <jwakely@redhat.com>
743         * config/abi/pre/gnu.ver (GLIBCXX_3.4.21): Make patterns less greedy
744         for const member functions of std::basic_string.
745         (GLIBCXX_3.4.26): Export member functions of std::basic_string added
746         in C++17.
747         * include/bits/basic_string.h (basic_string(__sv_wrapper, const A&)):
748         Make non-standard constructor private.
749         [!_GLIBCXX_USE_CXX11_ABI] (basic_string(__sv_wrapper, const A&)):
750         Likewise.
751         * include/bits/basic_string.tcc (std::string, std::wstring): Declare
752         explicit instantiations for C++17 as well as earlier dialects.
753         * src/c++17/Makefile.am: Add new source files.
754         * src/c++17/Makefile.in: Regenerate.
755         * src/c++17/cow-string-inst.cc: New file defining explicit
756         instantiations for basic_string member functions added in C++17.
757         * src/c++17/string-inst.cc: Likewise.
759         * config/abi/pre/gnu.ver (GLIBCXX_3.4.26): Export allocator-extended
760         copy/move constructors for old std::basic_string.
761         * include/bits/basic_string.h [!_GLIBCXX_USE_CXX11_ABI]
762         (basic_string::reference, basic_string::const_reference): Define
763         as plain references for C++11 and later.
764         (basic_string::basic_string()): Put constructor body outside
765         preprocessor conditional groups.
766         (basic_string::basic_string(basic_string&&)): Move _Alloc_hider
767         instead of copying it.
768         (basic_string::basic_string(const basic_string&, const _Alloc&)):
769         Define.
770         (basic_string::basic_string(basic_string&&, const _Alloc&)):
771         Define.
772         * include/bits/fs_path.h [!_GLIBCXX_USE_CXX11_ABI]: Remove special
773         cases for old basic_string.
774         * testsuite/21_strings/basic_string/cons/char/8.cc: Test
775         allocator-extended constructors unconditionally. Add extra members to
776         allocator type when using old string ABI.
777         * testsuite/21_strings/basic_string/allocator/71964.cc: Enable test
778         for old string ABI.
779         * testsuite/21_strings/basic_string/cons/wchar_t/8.cc: Likewise.
781         * testsuite/23_containers/list/61347.cc: Avoid spurious failure when
782         -fno-inline added to test flags.
784         * testsuite/21_strings/basic_string/requirements/
785         explicit_instantiation/debug.cc: Remove XFAIL for old ABI.
787         * testsuite/27_io/filesystem/filesystem_error/copy.cc: Fix static
788         assertion failures with old std::string ABI.
790         * include/bits/fs_path.h (path::_List::erase): Replace both overloads
791         with ...
792         (path::pop_back(), path::_M_erase_from(const_iterator)): New member
793         functions that will only erase elements at the end.
794         * src/filesystem/std-path.cc (path::_List::_Impl::pop_back()): Define.
795         (path::_List::_Impl::_M_erase_from(const_iterator)): Define.
796         (path::_List::operator=(const _List&)): Use _M_erase_from(p) instead
797         of erase(p, end()).
798         (path::_List::pop_back()): Define.
799         (path::_List::_M_erase_from(const_iterator)): Define.
800         (path::operator/=(const path&)): Use pop_back to remove last component
801         and _M_erase_from to remove multiple components.
802         (path::_M_append(basic_string_view<value_type>)): Likewise.
803         (path::operator+=(const path&)): Likewise.
804         (path::_M_concat(basic_string_view<value_type>)): Likewise.
805         (path::remove_filename()): Likewise.
806         (path::lexically_normal()): Use _List::_Impl iterators instead of
807         path::iterator. Use pop_back to remove components from the end. Clear
808         trailing filename, instead of using erase(const_iterator) to remove
809         a non-final component.
810         * testsuite/27_io/filesystem/path/generation/normal.cc: Test
811         additional cases.
812         * testsuite/27_io/filesystem/path/generation/normal2.cc: New test.
814         * src/filesystem/std-path.cc (path::operator+=(const path&)): Fix
815         incorrect treatment of empty filename after trailing slash.
816         * testsuite/27_io/filesystem/path/concat/path.cc: Test problem case.
818         * testsuite/21_strings/basic_string/modifiers/assign/char/
819         move_assign_optim.cc: Avoid spurious failure when -fno-inline added
820         to test flags.
821         * testsuite/21_strings/basic_string/modifiers/assign/wchar_t/
822         move_assign_optim.cc: Likewise.
824 2019-01-03  Jonathan Wakely  <jwakely@redhat.com>
825             Jakub Jelinek  <jakub@redhat.com>
827         PR libstdc++/88607
828         * include/experimental/memory: Replace UTF-8 quote characters.
829         * include/std/future: Replace UTF-8 "em dash" characters.
831 2019-01-03  Jonathan Wakely  <jwakely@redhat.com>
833         PR libstdc++/88607
834         * include/bits/forward_list.h: Replace UTF-8 "ligature fi" character.
835         * include/debug/forward_list: Likewise.
836         * include/experimental/bits/shared_ptr.h: Remove UTF-8 "section sign"
837         character.
838         * include/experimental/chrono: Likewise.
839         * include/experimental/functional: Likewise.
840         * include/experimental/ratio: Likewise.
841         * include/experimental/system_error: Likewise.
842         * include/experimental/tuple: Likewise.
843         * include/experimental/type_traits: Likewise.
844         * include/parallel/workstealing.h: Replace UTF-8 "en dash" character.
845         * include/parallel/multiseq_selection.h: Likewise.
847         PR libstdc++/88681
848         * config/abi/pre/gnu.ver: Add missing exports.
849         * testsuite/22_locale/collate_byname/88681.cc: New test.
850         * testsuite/22_locale/time_get/get/char/88681.cc: New test.
851         * testsuite/22_locale/time_get/get/wchar_t/88681.cc: New test.
853 2019-01-02  Jonathan Wakely  <jwakely@redhat.com>
855         * testsuite/23_containers/map/cons/deduction.cc: Test deduction from
856         initializer_list<value_type> and from input iterator ranges.
857         * testsuite/23_containers/multimap/cons/deduction.cc: Likewise.
859         * testsuite/experimental/string_view/element_access/char/empty.cc:
860         Fix year range in copyright header.
862 2019-01-02  Joel Brobecker  <brobecker@adacore.com>
864         * testsuite/21_strings/basic_string_view/element_access/char/empty.cc:
865         Fix year range in copyright header.
867 2019-01-01  Jakub Jelinek  <jakub@redhat.com>
869         Update copyright years.
871 Copyright (C) 2019 Free Software Foundation, Inc.
873 Copying and distribution of this file, with or without modification,
874 are permitted in any medium without royalty provided the copyright
875 notice and this notice are preserved.