aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3
AgeCommit message (Collapse)AuthorFilesLines
8 hourslibstdc++: Remove Paolo from list of people to contact about contributingJonathan Wakely2-6/+2
Paolo has not been active for some time. libstdc++-v3/ChangeLog: * doc/xml/manual/appendix_contributing.xml: Remove Paolo from list of maintainers to contact about contributing. * doc/html/manual/appendix_contributing.html: Regenerate.
8 hourslibstdc++: Document new generated headerJonathan Wakely2-0/+18
libstdc++-v3/ChangeLog: * doc/xml/manual/build_hacking.xml: Document that windows_zones-map.h is a generated file. * doc/html/manual/appendix_porting.html: Regenerate.
12 hourslibstdc++: Qualify addressof calls in inplace_vector [PR119137]Tomasz Kamiński1-2/+2
PR libstdc++/119137 libstdc++-v3/ChangeLog: * include/std/inplace_vector (inplace_vector::operator=): Qualify call to std::addressof.
12 hourslibstdc++: Fixed localized empty-spec formatting for months/weekdays [PR121154]Tomasz Kamiński3-52/+96
Previously for localized output, if _M_debug option was set, the _M_check_ok completed succesfully and _M_locale_fmt was called for months/weekdays that are !ok(). This patch lifts debug checks from each conversion function into _M_check_ok, that in case of !ok() values return a string_view containing the kind of calendar data, to be included after "is not a valid" string. The localized output (_M_locale_fmt) is not used if string is non-empty. Emitting of this message is now handled in _M_format_to, further reducing each specifier function. To handle weekday (%a,%A) and month (%b,%B), _M_check_ok now accepts a mutable reference to conversion specifier, and updates it to corresponding numeric value (%w, %m). Extra care needs to be taken to handle a month(0) that needs to be printed as single digit in debug format. Finally, the _M_time_point is replaced with _M_needs_ok_check member, that indicates if input contains any user-suplied values that are checked for being ok() and these values are referenced in chrono-specs. PR libstdc++/121154 libstdc++-v3/ChangeLog: * include/bits/chrono_io.h (_ChronoSpec::_M_time_point): Remove. (_ChronoSpec::_M_needs_ok_check): Define (__formatter_chrono::_M_parse): Set _M_needs_ok_check. (__formatter_chrono::_M_check_ok): Check values also for debug mode, and return __string_view. (__formatter_chrono::_M_format_to): Handle results of _M_check_ok. (__formatter_chrono::_M_wi, __formatter_chrono::_M_a_A) (__formatter_chrono::_M_b_B, __formatter_chrono::_M_C_y_Y) (__formatter_chrono::_M_d_e, __formatter_chrono::_M_F): Removed handling of _M_debug. (__formatter_chrono::__M_m): Print zero unpadded in _M_debug mode. (__formatter_duration::_S_spec_for): Remove _M_time_point refernce. (__formatter_duration::_M_parse): Override _M_needs_ok_check. * testsuite/std/time/month/io.cc: Test for localized !ok() values. * testsuite/std/time/weekday/io.cc: Test for localized !ok() values.
16 hourslibstdc++: Fix hash<__int128> test for x32 [PR121150]Jonathan Wakely1-2/+2
I incorrectly assumed that all targets that support __int128 use the LP64 ABI, so size_t is a 64-bit type. But x32 uses ILP32 and still supports __int128 (because it's an ILP32 target on 64-bit hardware). Add casts to the tests so that we get the correct expected values using size_t type. libstdc++-v3/ChangeLog: PR libstdc++/121150 * testsuite/20_util/hash/int128.cc: Cast expected values to size_t.
16 hourslibstdc++: Implement reverse iteration for _Utf_viewJonathan Wakely2-30/+183
This implements the missing functions in _Utf_iterator to support reverse iteration. All existing tests pass when the view is reversed, so that the same code units are seen when iterating forwards or backwards. libstdc++-v3/ChangeLog: * include/bits/unicode.h (_Utf_iterator::operator--): Reorder conditions and update position after reading a code unit. (_Utf_iterator::_M_read_reverse): Define. (_Utf_iterator::_M_read_utf8): Return extracted code point. (_Utf_iterator::_M_read_reverse_utf8): Define. (_Utf_iterator::_M_read_reverse_utf16): Define. (_Utf_iterator::_M_read_reverse_utf32): Define. * testsuite/ext/unicode/view.cc: Add checks for reversed views and reverse iteration. Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
16 hourslibstdc++: Optimize _Utf_iterator for sizeJonathan Wakely1-6/+6
This reorders the data members of _Utf_iterator to avoid padding bytes between members due to alignment requirements. For x86_64 the previous layout had padding after _M_buf and after _M_to_increment for the common case where the iterators and sentinel types are pointers, so the size shrinks from 40 bytes to 32 bytes. (For i686 there's no change, it's still 20 bytes). We could compress the three uint8_t members into one byte by using bit-fields: uint8_t _M_buf_index : 2; // [0,3] uint8_t _M_buf_last : 3; // [0,4] uint8_t _M_to_increment : 3; // [0,4] But there doesn't seem to be any point, because it will just be slower to access them and there will be tail padding so the size isn't any smaller. We could also reduce _M_buf_last and _M_to_increment to 2 bits because the 0 value is only used for a default constructed iterator, and we don't actually care about the values in that case. Again, this doesn't seem worth doing. libstdc++-v3/ChangeLog: * include/bits/unicode.h (_Utf_iterator): Reorder data members to be more compact. Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
17 hourslibstdc++: Add std::inplace_vector for C++26 (P0843R14) [PR119137]Jonathan Wakely25-1/+4365
Implement std::inplace_vector as specified in P0843R14, without follow up papers, in particular P3074R7 (trivial unions). In consequence inplace_vector<T, N> can be used inside constant evaluations only if T is trivial or N is equal to zero. We provide a separate specialization for inplace_vector<T, 0> to meet the requirements of N5008 [inplace.vector.overview] p5. In particular objects of such types needs to be empty. To allow constexpr variable of inplace_vector v, where v.size() < v.capacity(), we need to guaranteed that all elements of the storage array are initialized, even ones in range [v.data() + v.size(), v.data() + v.capacity()). This is perfoirmed by _M_init function, that is called by each constructor. By storing the array in anonymous union, we can perform this initialization in constant evaluation, avoiding the impact on runtime path. The size() function conveys the information that _M_size <= _Nm to compiler, by calling __builtin_unreachable(). In particular this allows us to eliminate FP warnings by using _Nm - size() instead of _Nm - _M_size, when computing available elements. The included test cover almost all code paths at runtime, however some compile time evaluation test are not yet implemented: * operations on range, they depend on making testsuite_iterators constexpr * negative test for invoking operations with preconditions at compile time, especially for zero size specialization. PR libstdc++/119137 libstdc++-v3/ChangeLog: * doc/doxygen/user.cfg.in (INPUT): Add new header. * include/Makefile.am: Add new header. * include/Makefile.in: Regenerate. * include/bits/stl_iterator_base_types.h (__any_input_iterator): Define. * include/bits/version.def (inplace_vector): Define. * include/bits/version.h: Regenerate. * include/precompiled/stdc++.h: Include new header. * src/c++23/std.cc.in: Export contents if new header. * include/std/inplace_vector: New file. * testsuite/23_containers/inplace_vector/access/capacity.cc: New file. * testsuite/23_containers/inplace_vector/access/elem.cc: New file. * testsuite/23_containers/inplace_vector/access/elem_neg.cc: New file. * testsuite/23_containers/inplace_vector/cons/1.cc: New file. * testsuite/23_containers/inplace_vector/cons/from_range.cc: New file. * testsuite/23_containers/inplace_vector/cons/throws.cc: New file. * testsuite/23_containers/inplace_vector/copy.cc: New file. * testsuite/23_containers/inplace_vector/erasure.cc: New file. * testsuite/23_containers/inplace_vector/modifiers/assign.cc: New file. * testsuite/23_containers/inplace_vector/modifiers/erase.cc: New file. * testsuite/23_containers/inplace_vector/modifiers/multi_insert.cc: New file. * testsuite/23_containers/inplace_vector/modifiers/single_insert.cc: New file. * testsuite/23_containers/inplace_vector/move.cc: New file. * testsuite/23_containers/inplace_vector/relops.cc: New file. * testsuite/23_containers/inplace_vector/version.cc: New file. * testsuite/util/testsuite_iterators.h (input_iterator_wrapper::base): Define. Reviewed-by: Patrick Palka <ppalka@redhat.com> Reviewed-by: Jonathan Wakely <jwakely@redhat.com> Co-authored-by: Tomasz Kamiński <tkaminsk@redhat.com> Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
25 hoursDaily bump.GCC Administrator1-0/+67
34 hourslibstdc++: Document change in __int128 traits [PRPR96710]Jonathan Wakely2-0/+8
libstdc++-v3/ChangeLog: PR libstdc++/96710 * doc/xml/manual/evolution.xml: Document change or __int128. * doc/html/manual/api.html: Regenerate.
35 hourslibstdc++: Fix forwarding of custom IndexType in mdspan [PR121061]Luc Grosheintz5-4/+17
The second bug report in PR121061 is that the conversion of custom OtherIndexType to IndexType is incorrectly not done via r-value references. This commit fixes the forwarding issue, adds a custom IndexType called RValueInt, which only allows conversion to int via r-value reference. PR libstdc++/121061 libstdc++-v3/ChangeLog: * include/std/mdspan (extents::extents): Perform conversion to index_type of an r-value reference. (layout_left::mapping::operator()): Ditto. (layout_right::mapping::operator()): Ditto. (layout_stride::mapping::operator()): Ditto. * testsuite/23_containers/mdspan/extents/custom_integer.cc: Add tests for RValueInt and MutatingInt. * testsuite/23_containers/mdspan/int_like.h (RValueInt): Add. * testsuite/23_containers/mdspan/layouts/mapping.cc: Test with RValueInt. * testsuite/23_containers/mdspan/mdspan.cc: Ditto. Reviewed-by: Jonathan Wakely <jwakely@redhat.com> Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com> Signed-off-by: Luc Grosheintz <luc.grosheintz@gmail.com>
35 hourslibstdc++: Fix constraint for custom integer types in mdspan [PR121061]Luc Grosheintz6-14/+34
PR121061 consists of two bugs for mdspan related code. This commit fixes the first one. Namely, when passing custom IndexType as an array or span, the conversion to int must be const. Prior to this commit the constraint incorrectly also allowed non-const conversion. This commit updates all related constraints to check __valid_index_type<const OtherIndexType&, index_type> in those cases. Also adds a MutatingInt to int_like.h which only supports non-const conversion to int and updates the tests. PR libstdc++/121061 libstdc++-v3/ChangeLog: * include/std/mdspan (extents::extents): Fix constraint to prevent non-const conversion to index_type. (layout_stride::mapping::mapping): Ditto. (mdspan::mdspan): Ditto. (mdspan::operator[]): Ditto. * testsuite/23_containers/mdspan/extents/custom_integer.cc: Add test for MutatingInt. * testsuite/23_containers/mdspan/int_like.h (MutatingInt): Add. * testsuite/23_containers/mdspan/layouts/mapping.cc: Add test for MutatingInt. * testsuite/23_containers/mdspan/layouts/stride.cc: Ditto. * testsuite/23_containers/mdspan/mdspan.cc: Ditto. Reviewed-by: Jonathan Wakely <jwakely@redhat.com> Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com> Signed-off-by: Luc Grosheintz <luc.grosheintz@gmail.com>
35 hourslibstdc++: Refactor mdspan tests [PR121061]Luc Grosheintz6-196/+274
PR121061 shows that the test coverage for custom integer types is insufficient. Custom IndexTypes are passed to mdspan related objects in one of two ways: * as a template parameter pack, * or as an array/span. These two cases have different requirements on the (constness of) custom IndexTypes. Therefore, the tests are restructured as follows: * allow testing with different custom integers, * separate code that tests the two cases described above, * use int_like.h for all tests with custom integers. The affected tests are for: * creating extents, layout_stride::mapping and mdspan from custom integers, * mapping::operator() and mdspan::operator[]. PR libstdc++/121061 libstdc++-v3/ChangeLog: * testsuite/23_containers/mdspan/extents/custom_integer.cc: Enable checking with different custom integers. Improve checking non-existence of overloads for incompatible custom integers. * testsuite/23_containers/mdspan/layouts/mapping.cc: ditto. Also improve reuse of int_like.h. * testsuite/23_containers/mdspan/layouts/stride.cc: ditto. * testsuite/23_containers/mdspan/mdspan.cc: ditto. * testsuite/23_containers/mdspan/extents/int_like.h: Rename (old name). * testsuite/23_containers/mdspan/int_like.h: Rename (new name). (ThrowingInt): Add. (NotIntLike): Add. Reviewed-by: Jonathan Wakely <jwakely@redhat.com> Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com> Signed-off-by: Luc Grosheintz <luc.grosheintz@gmail.com>
40 hourslibstdc++: Add comments to __unicode::_Utf_iteratorJonathan Wakely1-9/+38
Add comments documenting what it does and how it does it. Also reorder the if-else in operator++ so that we check whether to iterate over code units in the local buffer before checking whether to refill that buffer. That seems the more natural way to structure the function. libstdc++-v3/ChangeLog: * include/bits/unicode.h (__unicode::_Utf_iterator): Add comments. (__unicode:_Utf_iterator::operator++()): Check whether to iterate over the buffer first. Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
40 hourslibstdc++: Use __promote_3 for std::hypot [PR121097]Jonathan Wakely1-2/+2
The __promoted_t alias is only defined when __cpp_fold_expressions is defined, which might not be the case for some hypothetical C++17 compilers. Change the 3-arg std::hypot to just use __gnu_cxx::__promote_3 which is always available. libstdc++-v3/ChangeLog: PR libstdc++/121097 * include/c_global/cmath (hypot): Use __promote_3 instead of __promoted. Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
2 daysDaily bump.GCC Administrator1-0/+14
3 dayslibstdc++: Use basic_string_view for std::bitset deduced typesJonathan Wakely1-1/+4
This change was part of by P2697R1 (Interfacing bitset with string_view) and should be slightly cheaper to instantiate. We should consider using basic_string_view for C++17, C++20, and C++23 as well. This patch just conservatively changes it for C++26 to match the working draft. It's conceivable that a program-defined specialization of basic_string<_CharT> or basic_string_view<_CharT> will observe a difference and be affected by this change. libstdc++-v3/ChangeLog: * include/std/bitset (__bitset::__string) [__cpp_lib_bitset]: Change alias to refer to basic_string_view instead. Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
3 dayslibstdc++: Do not define __cpp_lib_constexpr_exceptions [PR121114]Tomasz Kamiński3-7/+7
Do not advertise library support for constexpr exceptions, as our solution to throwing by __throw_* functions from <bits/functexcept.h>, caues constant evaluation to fail, as these functions are not constexpr. PR libstdc++/121114 libstdc++-v3/ChangeLog: * include/bits/version.def (constexpr_exceptions): Add no_stdname and changed value. * include/bits/version.h: Regenerated. * testsuite/18_support/exception/version.cc: Test that macro is not exported. Reviewed-by: Jonathan Wakely <jwakely@redhat.com> Signed-off-by: Tomasz Kaminski <tkaminsk@redhat.com>
3 daysDaily bump.GCC Administrator1-0/+102
3 dayslibstdc++: Constrain std::swap using concepts in C++20Jonathan Wakely1-12/+18
This is a minor compile-time optimization for C++20. libstdc++-v3/ChangeLog: * include/bits/move.h (swap): Replace enable_if with concepts when available, and with __enable_if_t alias otherwise.
3 dayslibstdc++: Make ranges::advance(it, n, bound) follow standard more strictlyJonathan Wakely1-4/+16
The standard specifies some of the effects of ranges::advance in terms of "Equivalent to:" and it's observable that our current implementation deviates from the precise specification in the standard. This was causing some failures in the libc++ testsuite. For the sized_sentinel_for<I, S> case I optimized our implementation to avoid redundant calls when we have already checked that there's nothing to do. We were eliding `advance(i, bound)` when the iterator already equals the sentinel, and eliding `advance(i, n)` when `n` is zero. In both cases, removing the seemingly redundant calls is not equivalent to the spec because `i = std::move(bound)` or `i += 0` operations can be observed by program-defined iterators. This patch inlines the observable side effects of advance(i, bound) or advance(i, 0) without actually calling those functions. For the non-sized sentinel case, `if (i == bound || n == 0)` is different from `if (n == 0 || i == bound)` for the case where n is zero and a program-defined iterator observes the number of comparisons. This patch changes it to do `n == 0` first. I don't think this is required by the standard, as this condition is not "Equivalent to:" any observable sequence of operations, but testing `n == 0` first is probably cheaper anyway. libstdc++-v3/ChangeLog: * include/bits/ranges_base.h (ranges::advance(i, n, bound)): Ensure that observable side effects on iterators match what is specified in the standard. Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
3 dayslibstdc++: Add missing initializers for __maybe_present_t members [PR119962]Patrick Palka4-3/+30
Data members of type __maybe_present_t where the conditionally present type might be an aggregate or fundamental type need to be explicitly value-initialized (rather than implicitly default-initialized), so that default-initialization of the containing class always results in an completely initialized object. PR libstdc++/119962 libstdc++-v3/ChangeLog: * include/std/ranges (join_view::_Iterator::_M_outer): Initialize. (lazy_split_view::_OuterIter::_M_current): Initialize. (join_with_view::_Iterator::_M_outer_it): Initialize. * testsuite/std/ranges/adaptors/join.cc (test15): New test. * testsuite/std/ranges/adaptors/join_with/1.cc (test05): New test. * testsuite/std/ranges/adaptors/lazy_split.cc (test13): New test. Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com> Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
3 dayslibstdc++: Implement std::chrono::current_zone() for Windows [PR108409]Björn Schäpers3-2/+614
On Windows there is no API to get the current time zone as IANA name, instead Windows has its own zones. But there exists a mapping provided by the Unicode Consortium. This patch adds a script to convert the XML file with the mapping to a lookup table and adds a Windows code path to use that mapping. libstdc++-v3/Changelog: Implement std::chrono::current_zone() for Windows PR libstdc++/108409 * scripts/gen_windows_zones_map.py: New file, generates windows_zones-map.h. * src/c++20/windows_zones-map.h: New file, contains the look up table. * src/c++20/tzdb.cc (tzdb::current_zone): Add Windows code path. Signed-off-by: Björn Schäpers <bjoern@hazardy.de>
3 dayslibstdc++: Search for tzdata on Windows (msys)Björn Schäpers1-0/+34
Windows does not provide a tzdata.zi, but msys does. Use this, if available, instead of the embedded (and possibly outdated) database. libstdc++-v3/Changelog: Use msys provided time zone information. * src/c++20/tzdb.cc (zoneinfo_file): On Windows look relative from the DLL path for the time zone information. Signed-off-by: Björn Schäpers <bjoern@hazardy.de>
3 dayslibstdc++: Tweak dg-error patterns for C++26 constexpr changesJonathan Wakely9-9/+9
libstdc++-v3/ChangeLog: * testsuite/25_algorithms/copy/debug/constexpr_neg.cc: * testsuite/25_algorithms/copy_backward/debug/constexpr_neg.cc: * testsuite/25_algorithms/equal/debug/constexpr_neg.cc: * testsuite/25_algorithms/lower_bound/debug/constexpr_partitioned_neg.cc: * testsuite/25_algorithms/lower_bound/debug/constexpr_partitioned_pred_neg.cc: * testsuite/25_algorithms/lower_bound/debug/constexpr_valid_range_neg.cc: * testsuite/25_algorithms/upper_bound/debug/constexpr_partitioned_neg.cc: * testsuite/25_algorithms/upper_bound/debug/constexpr_partitioned_pred_neg.cc: * testsuite/25_algorithms/upper_bound/debug/constexpr_valid_range_neg.cc:
4 dayslibstdc++: Ensure that ranges::destroy destroys in constexpr [PR121024]Jonathan Wakely2-14/+89
The new test is currently marked as XFAIL because PR c++/102284 means that GCC doesn't notice that the lifetimes have ended. libstdc++-v3/ChangeLog: PR libstdc++/121024 * include/bits/ranges_uninitialized.h (ranges::destroy): Do not optimize away trivial destructors during constant evaluation. (ranges::destroy_n): Likewise. * testsuite/20_util/specialized_algorithms/destroy/121024.cc: New test. Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
4 dayslibstdc++: Make all experimental::observer_ptr functions constexprJonathan Wakely4-31/+50
I've just created LWG 4295 proposing this change, and am implementing it via this patch. libstdc++-v3/ChangeLog: * include/experimental/memory (swap, make_observer_ptr): Add constexpr. (operator==, operator!=, operator<, operator>, operator<=) (operator>=): Likewise. * testsuite/experimental/memory/observer_ptr/make_observer.cc: Checks for constant evaluation. * testsuite/experimental/memory/observer_ptr/relops/relops.cc: Likewise. * testsuite/experimental/memory/observer_ptr/swap/swap.cc: Likewise. Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
4 dayslibstdc++: Ensure std::make_unsigned<Enum> works for 128-bit enumJonathan Wakely2-1/+20
Another follow-up to r16-2190-g4faa42ac0dee2c, ensuring that make_signed and make_unsigned work on enumeration types with 128-bit integers as their underlying type. libstdc++-v3/ChangeLog: * include/std/type_traits (__make_unsigned_selector): Add unsigned __int128 to type list. * testsuite/20_util/make_unsigned/int128.cc: New test. Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
4 dayslibstdc++: Ensure std::hash<__int128> is defined [PR96710]Jonathan Wakely2-0/+29
This is a follow-up to r16-2190-g4faa42ac0dee2c which ensures that std::hash is always enabled for signed and unsigned __int128. The standard requires std::hash to be enabled for all arithmetic types. libstdc++-v3/ChangeLog: PR libstdc++/96710 * include/bits/functional_hash.h (hash<__int128>): Define for strict modes. (hash<unsigned __int128>): Likewise. * testsuite/20_util/hash/int128.cc: New test. Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
4 dayslibstdc++: Format %a/%A/%b/%h/%B/%p without using locale::classic [PR110739]Tomasz Kamiński1-67/+87
With changes r16-2063-g8ad5968a8dcb47 the _M_a_A, _M_b_B and _M_p functions are called only if the locale is equal to the locale::classic(), for which the behavior is know. This patch changes they implementation, so instead of reffering to __timepunct facet members, they use hardcoded list of English weekday, months names. Only one list is needed, as in case of locale::classic() abbreviated name corresponds to first tree letters of the full name. For _M_p, _M_r we use a new _M_fill_ampm helper, that fills provided buffer with "AM"/"PM" depending on the hours value. In _M_S we no longer guard querying of numpuct facet, with check that requires potentially equally expensive construction of locale::classic. We also mark localized path as unlikely. The _M_locale method is no longer used in __formatter_chrono, and thus was moved to __formatter_duration. PR libstdc++/110739 libstdc++-v3/ChangeLog: * include/bits/chrono_io.h (__formatter_chrono::_S_weekdays) (__formatter_chrono::_S_months, __formatter_chrono::_S_fill_ampm): Define. (__formatter_chrono::_M_format_to): Do not pass context parameter to functions listed below. (__formatter_chrono::_M_a_A, __formatter_chrono::_M_b_B): Implement using harcoded list of names, and remove format context parameter. (__formatter_chrono::_M_p, __formatter_chrono::_M_r): Implement using _S_fill_ampm. (__formatter_chrono::_M_c): Removed format context parameter. (__formatter_chrono::_M_subsecs): Call __ctx.locale() directly, instead of _M_locale and do not compare with locale::classic(). Add [[unlikely]] attributes. (__formatter_chrono::_M_locale): Move to __formatter_duration. (__formatter_duration::_M_locale): Moved from __formatter_chrono.
4 daysDaily bump.GCC Administrator1-0/+48
4 dayslibstdc++: Add comments to deleted std::swap overloads for LWG 2766Jonathan Wakely7-4/+16
We pre-emptively implemented part of LWG 2766, which still hasn't been approved. Add comments to the deleted swap overloads saying why they're there, because the standard doesn't require them. libstdc++-v3/ChangeLog: * include/bits/stl_pair.h (swap): Add comment to 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_neg.cc: Adjust dg-error line numbers.
5 dayslibstdc++: Protect PSTL headers against overloaded commasJonathan Wakely3-16/+16
Reported upstream: https://github.com/uxlfoundation/oneDPL/issues/2342 libstdc++-v3/ChangeLog: * include/pstl/algorithm_impl.h (__for_each_n_it_serial): Protect against overloaded comma operator. (__brick_walk2): Likewise. (__brick_walk2_n): Likewise. (__brick_walk3): Likewise. (__brick_move_destroy::operator()): Likewise. (__brick_calc_mask_1): Likewise. (__brick_copy_by_mask): Likewise. (__brick_partition_by_mask): Likewise. (__brick_calc_mask_2): Likewise. (__brick_reverse): Likewise. (__pattern_partial_sort_copy): Likewise. * include/pstl/memory_impl.h (__brick_uninitialized_move): Likewise. (__brick_uninitialized_copy): Likewise. * include/pstl/numeric_impl.h (__brick_transform_scan): Likewise.
5 dayslibstdc++: Correct value of __cpp_lib_constexpr_exceptions [PR117785]Jonathan Wakely4-3/+14
Only P3068R6 (Allowing exception throwing in constant-evaluation) is implemented in the library so far, so the value of the constexpr_exceptions feature test macro should be 202411L. Once we support the library changes in P3378R2 (constexpr exception types) then we can set the value to 202502L again. libstdc++-v3/ChangeLog: PR libstdc++/117785 * include/bits/version.def (constexpr_exceptions): Define correct value. * include/bits/version.h: Regenerate. * libsupc++/exception: Check correct value. * testsuite/18_support/exception/version.cc: New test.
5 dayslibstdc++: Fix constexpr exceptions for -fno-exceptionsJonathan Wakely1-58/+55
The if-consteval branches in std::make_exception_ptr and std::exception_ptr_cast use a try-catch block, which gives an error for -fno-exceptions. Just make them return a null pointer at compile-time when -fno-exceptions is used, because there's no way to get an active exception with -fno-exceptions. For both functions we have a runtime-only branch that depends on RTTI, and a fallback using try-catch which works for runtime and consteval. Rearrange both functions to express this logic more clearly. Also adjust some formatting and whitespace elsewhere in the file. libstdc++-v3/ChangeLog: * libsupc++/exception_ptr.h (make_exception_ptr): Return null for consteval when -fno-exceptions is used. (exception_ptr_cast): Likewise. Allow consteval path to work with -fno-rtti. Reviewed-by: Jakub Jelinek <jakub@redhat.com>
7 daysDaily bump.GCC Administrator1-0/+53
8 dayslibstdc++: Implement C++26 P3748R0 - Inspecting exception_ptr should be ↵Jakub Jelinek2-9/+43
constexpr The following patch makes std::exception_ptr_cast constexpr. The paper suggests using dynamic_cast, but that does only work for polymorphic exceptions, doesn't work if they are scalar or non-polymorphic classes. Furthermore, the patch adds some static_asserts for "Mandates: E is a cv-unqualified complete object type. E is not an array type. E is not a pointer or pointer-to-member type." 2025-07-11 Jakub Jelinek <jakub@redhat.com> * libsupc++/exception_ptr.h: Implement C++26 P3748R0 - Inspecting exception_ptr should be constexpr. (std::exception_ptr_cast): Make constexpr, remove inline keyword. Add static_asserts for Mandates. For if consteval use std::rethrow_exception, catch it and return its address or nullptr. * testsuite/18_support/exception_ptr/exception_ptr_cast.cc (E::~E): Add constexpr. (G::G): Likewise. (test01): Likewise. Return bool and take bool argument, throw if the argument is true. Add static_assert(test01(false)). (main): Call test01(true) in try.
8 dayslibstdc++: Always treat __float128 as a floating-point typeJonathan Wakely3-2/+11
Similar to the previous commit that made is_integral_v<__int128> unconditionally true, this makes is_floating_point_v<__float128> unconditionally true. With the new extended floating-point types in C++23 (std::float64_t etc.) it seems unhelpful for is_floating_point_v to be true for them, but not for __float128. Especially as it is true on some targets, because __float128 is just a typedef for long double. This change makes is_floating_point_v<__float128> true whenever the type is defined, giving less surprising and more portable behaviour. libstdc++-v3/ChangeLog: * include/bits/cpp_type_traits.h (__is_floating<__float128>): Do not depend on __STRICT_ANSI__. * include/bits/stl_algobase.h (__size_to_integer(__float128)): Likewise. * include/std/type_traits (__is_floating_point_helper<__float128>): Likewise. Reviewed-by: Patrick Palka <ppalka@redhat.com>
8 dayslibstdc++: Treat __int128 as a real integral type [PR96710]Jonathan Wakely10-106/+67
Since LWG 3828 (included in C++23) implementations are allowed to have extended integer types that are wider than intmax_t. This means we no longer have to make is_integral_v<__int128> false for strict -std=c++23 mode, removing the confusing inconsistency with -std=gnu++23 (where is_integral_v<__int128> is true). This change makes __int128 a true integral type for all modes, treating LWG 3828 as a DR for previous standards. Most of the change just involves removing special cases where we wanted to treat __int128 and unsigned __int128 as integral types even when is_integral_v was false. There are still some preprocessor conditionals needed, because on some targets the compiler defines the macro __GLIBCXX_TYPE_INT_N_0 as __int128 in non-strict modes. Because we define explicit specializations of templates such as is_integral for all the INT_N types, we already have a specialization of is_integral<__int128> in non-strict modes, and so to avoid a redefinition we only must only define is_integral<__int128> for strict modes. libstdc++-v3/ChangeLog: PR libstdc++/96710 * include/bits/cpp_type_traits.h (__is_integer): Define explicit specializations for __int128. (__memcpyable_integer): Remove explicit specializations for __int128. * include/bits/iterator_concepts.h (incrementable_traits): Likewise. (__is_signed_int128, __is_unsigned_int128, __is_int128): Remove. (__is_integer_like, __is_signed_integer_like): Remove check for __int128. * include/bits/max_size_type.h: Remove all uses of __is_int128 in constraints. * include/bits/ranges_base.h (__to_unsigned_like): Remove overloads for __int128. (ranges::ssize): Remove special case for __int128. * include/bits/stl_algobase.h (__size_to_integer): Define __int128 overloads for strict modes. * include/ext/numeric_traits.h (__is_integer_nonstrict): Remove explicit specializations for __int128. * include/std/charconv (to_chars): Define overloads for __int128. * include/std/format (__format::make_unsigned_t): Remove. (__format::to_chars): Remove. * include/std/limits (numeric_limits): Define explicit specializations for __int128. * include/std/type_traits (__is_integral_helper): Likewise. (__make_unsigned, __make_signed): Likewise. Reviewed-by: Patrick Palka <ppalka@redhat.com>
8 daysDaily bump.GCC Administrator1-0/+66
8 daysc++, libstdc++: Implement C++26 P3068R5 - constexpr exceptions [PR117785]Jakub Jelinek8-40/+171
The following patch implements the C++26 P3068R5 - constexpr exceptions paper. As the IL cxx_eval_constant* functions process already contains the low level calls like __cxa_{allocate,free}_exception, __cxa_{,re}throw etc., the patch just makes 10 extern "C" __cxa_* functions magic builtins which during constant evaluation pretend to be constexpr even when not declared so and handle them directly, plus does the same for 3 std namespace functions - std::uncaught_exceptions, std::current_exception and std::rethrow_exception and adds one new FE builtin - __builtin_eh_ptr_adjust_ref which the library can use instead of the _M_addref and _M_release out of line methods (this one instead of recognizing _M_* as magic too because those are clearly specific to libstdc++ and e.g. libc++ could use something else). The patch uses magic VAR_DECLs with heap_{uninit_,,deleted_}identifier DECL_NAME like for operator new/delete for objects allocated with __cxa_allocate_exception, just sets their DECL_LANG_SPECIFIC so that we can track their reference count as well (with std::exception_ptr the same exception object can be referenced multiple times and we want to destruct and free only when it reaches zero refcount). For uncaught exceptions being propagated, the patch uses new kind of *jump_target, which is that magic VAR_DECL described above. The largest change in the patch is making jump_target argument non-optional in cxa_eval_constant_exception and all functions it calls that need it. This is because exceptions can be thrown from pretty much everywhere, e.g. binary expression can throw in either operand. And the patch also adds if (*jump_target) return NULL_TREE; or similar in many spots, so that we don't crash because cxx_eval_constant_expression returned NULL_TREE somewhere before actually trying to use it and so that we don't uselessly dive into other operands etc. Note, with statement expressions actually this was something we just didn't handle correctly before, one can validly have: a = ({ if (x) return 42; 12; }) + b; or in the other operand, or break/continue instead of return if it is somewhere in a loop/switch; and it isn't ok to branch from one operand to another one through some kind of goto. On the potential_constant_expression_1 side, important change was to set *jump_target conservatively on calls that could throw for C++26 (the patch uses magic void_node for potential_constant_expression* instead of VAR_DECL, so that we don't have to create new VAR_DECLs there uselessly). Without that change, several methods in libstdc++ wouldn't work correctly. I'm not sure what exactly potential_constant_expression_1 maps to in the C++26 standard wording now and whether doing that is ok, because basically after the first call to non-noexcept function it stops checking stuff. And, in some spots where I know potential_constant_expression_1 didn't check some subexpressions (e.g. the EH only cleanups or TRY_BLOCK handlers) I've added *potential_constant_expression* calls during cxx_eval_constant*, not sure if I need to do that because potential_constant_expression_1 is very conservative and just doesn't recurse on subexpressions in many cases. 2025-07-10 Jakub Jelinek <jakub@redhat.com> PR c++/117785 gcc/c-family/ * c-cppbuiltin.cc (c_cpp_builtins): Predefine __cpp_constexpr_exceptions=202411L for C++26. gcc/cp/ * constexpr.cc: Implement C++26 P3068R5 - constexpr exceptions. (class constexpr_global_ctx): Add caught_exceptions and uncaught_exceptions members. (constexpr_global_ctx::constexpr_global_ctx): Initialize uncaught_exceptions. (returns, breaks, continues, switches): Move earlier. (throws): New function. (exception_what_str, diagnose_std_terminate, diagnose_uncaught_exception): New functions. (enum cxa_builtin): New type. (cxx_cxa_builtin_fn_p, cxx_eval_cxa_builtin_fn): New functions. (cxx_eval_builtin_function_call): Add jump_target argument. Call cxx_eval_cxa_builtin_fn for __builtin_eh_ptr_adjust_ref. Adjust cxx_eval_constant_expression calls, if it results in jmp_target, set *jump_target to it and return. (cxx_bind_parameters_in_call): Add jump_target argument. Pass it through to cxx_eval_constant_expression. If it sets *jump_target, break. (fold_operand): Adjust cxx_eval_constant_expression caller. (cxx_eval_assert): Likewise. If it set jmp_target, return true. (cxx_eval_internal_function): Add jump_target argument. Pass it through to cxx_eval_constant_expression. Return early if *jump_target after recursing on args. (cxx_eval_dynamic_cast_fn): Likewise. Don't set reference_p for C++26 with -fexceptions. (cxx_eval_thunk_call): Add jump_target argument. Pass it through to cxx_eval_constant_expression. (cxx_set_object_constness): Likewise. Don't set TREE_READONLY if throws (jump_target). (cxx_eval_call_expression): Add jump_target argument. Pass it through to cxx_eval_internal_function, cxx_eval_builtin_function_call, cxx_eval_thunk_call, cxx_eval_dynamic_cast_fn and cxx_set_object_constness. Pass it through also cxx_eval_constant_expression on arguments, cxx_bind_parameters_in_call and cxx_fold_indirect_ref and for those cases return early if *jump_target. Call cxx_eval_cxa_builtin_fn for cxx_cxa_builtin_fn_p functions. For cxx_eval_constant_expression on body, pass address of cleared jmp_target automatic variable, if it throws propagate to *jump_target and make it non-cacheable. For C++26 don't diagnose calls to non-constexpr functions before cxx_bind_parameters_in_call could report some argument throwing an exception. (cxx_eval_unary_expression): Add jump_target argument. Pass it through to cxx_eval_constant_expression and return early if *jump_target after the call. (cxx_fold_pointer_plus_expression): Likewise. (cxx_eval_binary_expression): Likewise and similarly for cxx_fold_pointer_plus_expression call. (cxx_eval_conditional_expression): Pass jump_target to cxx_eval_constant_expression on first operand and return early if *jump_target after the call. (cxx_eval_vector_conditional_expression): Add jump_target argument. Pass it through to cxx_eval_constant_expression for all 3 arguments and return early if *jump_target after any of those calls. (get_array_or_vector_nelts): Add jump_target argument. Pass it through to cxx_eval_constant_expression. (eval_and_check_array_index): Add jump_target argument. Pass it through to cxx_eval_constant_expression calls and return early after each of them if *jump_target. (cxx_eval_array_reference): Likewise. (cxx_eval_component_reference): Likewise. (cxx_eval_bit_field_ref): Likewise. (cxx_eval_bit_cast): Likewise. Assert CHECKING_P call doesn't throw or return. (cxx_eval_logical_expression): Add jump_target argument. Pass it through to cxx_eval_constant_expression calls and return early after each of them if *jump_target. (cxx_eval_bare_aggregate): Likewise. (cxx_eval_vec_init_1): Add jump_target argument. Pass it through to cxx_eval_bare_aggregate and recursive call. Pass it through to get_array_or_vector_nelts and cxx_eval_constant_expression and return early after it if *jump_target. (cxx_eval_vec_init): Add jump_target argument. Pass it through to cxx_eval_constant_expression and cxx_eval_vec_init_1. (cxx_union_active_member): Add jump_target argument. Pass it through to cxx_eval_constant_expression and return early after it if *jump_target. (cxx_fold_indirect_ref_1): Add jump_target argument. Pass it through to cxx_union_active_member and recursive calls. (cxx_eval_indirect_ref): Add jump_target argument. Pass it through to cxx_fold_indirect_ref_1 calls and to recursive call, in which case return early after it if *jump_target. (cxx_fold_indirect_ref): Add jump_target argument. Pass it through to cxx_fold_indirect_ref and cxx_eval_constant_expression calls and return early after those if *jump_target. (cxx_eval_trinary_expression): Add jump_target argument. Pass it through to cxx_eval_constant_expression calls and return early after those if *jump_target. (cxx_eval_store_expression): Add jump_target argument. Pass it through to cxx_eval_constant_expression and eval_and_check_array_index calls and return early after those if *jump_target. (cxx_eval_increment_expression): Add jump_target argument. Pass it through to cxx_eval_constant_expression calls and return early after those if *jump_target. (label_matches): Handle VAR_DECL case. (cxx_eval_statement_list): Remove local_target variable and !jump_target handling. Handle throws (jump_target) like returns or breaks. (cxx_eval_loop_expr): Remove local_target variable and !jump_target handling. Pass it through to cxx_eval_constant_expression. Handle throws (jump_target) like returns. (cxx_eval_switch_expr): Pass jump_target through to cxx_eval_constant_expression on cond, return early after it if *jump_target. (build_new_constexpr_heap_type): Add jump_target argument. Pass it through to cxx_eval_constant_expression calls, return early after those if *jump_target. (merge_jump_target): New function. (cxx_eval_constant_expression): Make jump_target argument no longer defaulted, don't test jump_target for NULL. Pass jump_target through to recursive calls, cxx_eval_call_expression, cxx_eval_store_expression, cxx_eval_indirect_ref, cxx_eval_unary_expression, cxx_eval_binary_expression, cxx_eval_logical_expression, cxx_eval_array_reference, cxx_eval_component_reference, cxx_eval_bit_field_ref, cxx_eval_vector_conditional_expression, cxx_eval_bare_aggregate, cxx_eval_vec_init, cxx_eval_trinary_expression, cxx_fold_indirect_ref, build_new_constexpr_heap_type, cxx_eval_increment_expression, cxx_eval_bit_cast and return earlyu after some of those if *jump_target as needed. (cxx_eval_constant_expression) <case TARGET_EXPR>: For C++26 push also CLEANUP_EH_ONLY cleanups, with NULL_TREE marker after them. (cxx_eval_constant_expression) <case RETURN_EXPR>: Don't override *jump_target if throws (jump_target). (cxx_eval_constant_expression) <case TRY_CATCH_EXPR, case TRY_BLOCK, case MUST_NOT_THROW_EXPR, case TRY_FINALLY_EXPR, case CLEANUP_STMT>: Handle C++26 constant expressions. (cxx_eval_constant_expression) <case CLEANUP_POINT_EXPR>: For C++26 with throws (jump_target) evaluate the CLEANUP_EH_ONLY cleanups as well, and if not throws (jump_target) skip those. Set *jump_target if some of the cleanups threw. (cxx_eval_constant_expression) <case THROW_EXPR>: Recurse on operand for C++26. (cxx_eval_outermost_constant_expr): Diagnose uncaught exceptions both from main expression and cleanups, diagnose also break/continue/returns from the main expression. Handle CLEANUP_EH_ONLY cleanup markers. Don't diagnose mutable poison stuff if non_constant_p. Use different diagnostics for non-deleted heap allocations if they were allocated by __cxa_allocate_exception. (callee_might_throw): New function. (struct check_for_return_continue_data): Add could_throw field. (check_for_return_continue): Handle AGGR_INIT_EXPR and CALL_EXPR and set d->could_throw if they could throw. (potential_constant_expression_1): For CALL_EXPR allow cxx_dynamic_cast_fn_p calls. For C++26 set *jump_target to void_node for calls that could throw. For C++26 if call to non-constexpr call is seen, try to evaluate arguments first and if they could throw, don't diagnose call to non-constexpr function nor return false. Adjust check_for_return_continue_data initializers and set *jump_target to void_node if data.could_throw_p. For C++26 recurse on THROW_EXPR argument. Add comment explaining TRY_BLOCK handling with C++26 exceptions. Handle throws like returns in some cases. * cp-tree.h (MUST_NOT_THROW_NOEXCEPT_P, MUST_NOT_THROW_THROW_P, MUST_NOT_THROW_CATCH_P, DECL_EXCEPTION_REFCOUNT): Define. (DECL_LOCAL_DECL_P): Fix comment typo, VARIABLE_DECL -> VAR_DECL. (enum cp_built_in_function): Add CP_BUILT_IN_EH_PTR_ADJUST_REF, (handler_match_for_exception_type): Declare. * call.cc (handler_match_for_exception_type): New function. * except.cc (initialize_handler_parm): Set MUST_NOT_THROW_CATCH_P on newly created MUST_NOT_THROW_EXPR. (begin_eh_spec_block): Set MUST_NOT_THROW_NOEXCEPT_P. (wrap_cleanups_r): Set MUST_NOT_THROW_THROW_P. (build_throw): Add another TARGET_EXPR whose scope spans until after the __cxa_throw call and copy pointer value from ptr to it and use it in __cxa_throw argument. * tree.cc (builtin_valid_in_constant_expr_p): Handle CP_BUILT_IN_EH_PTR_ADJUST_REF. * decl.cc (cxx_init_decl_processing): Initialize __builtin_eh_ptr_adjust_ref FE builtin. * pt.cc (tsubst_stmt) <case MUST_NOT_THROW_EXPR>: Copy the MUST_NOT_THROW_NOEXCEPT_P, MUST_NOT_THROW_THROW_P and MUST_NOT_THROW_CATCH_P flags. * cp-gimplify.cc (cp_gimplify_expr) <case CALL_EXPR>: Error on non-folded CP_BUILT_IN_EH_PTR_ADJUST_REF calls. gcc/testsuite/ * g++.dg/cpp0x/constexpr-ellipsis2.C: Expect different diagnostics for C++26. * g++.dg/cpp0x/constexpr-throw.C: Likewise. * g++.dg/cpp1y/constexpr-84192.C: Expect different diagnostics. * g++.dg/cpp1y/constexpr-throw.C: Expect different diagnostics for C++26. * g++.dg/cpp1z/constexpr-asm-5.C: Likewise. * g++.dg/cpp26/constexpr-eh1.C: New test. * g++.dg/cpp26/constexpr-eh2.C: New test. * g++.dg/cpp26/constexpr-eh3.C: New test. * g++.dg/cpp26/constexpr-eh4.C: New test. * g++.dg/cpp26/constexpr-eh5.C: New test. * g++.dg/cpp26/constexpr-eh6.C: New test. * g++.dg/cpp26/constexpr-eh7.C: New test. * g++.dg/cpp26/constexpr-eh8.C: New test. * g++.dg/cpp26/constexpr-eh9.C: New test. * g++.dg/cpp26/constexpr-eh10.C: New test. * g++.dg/cpp26/constexpr-eh11.C: New test. * g++.dg/cpp26/constexpr-eh12.C: New test. * g++.dg/cpp26/constexpr-eh13.C: New test. * g++.dg/cpp26/constexpr-eh14.C: New test. * g++.dg/cpp26/constexpr-eh15.C: New test. * g++.dg/cpp26/feat-cxx26.C: Change formatting in __cpp_pack_indexing and __cpp_pp_embed test. Add __cpp_constexpr_exceptions test. * g++.dg/cpp26/static_assert1.C: Expect different diagnostics for C++26. * g++.dg/cpp2a/consteval34.C: Likewise. * g++.dg/cpp2a/consteval-memfn1.C: Likewise. * g++.dg/cpp2a/constexpr-dynamic4.C: For C++26 add std::exception and std::bad_cast definitions and expect different diagnostics. * g++.dg/cpp2a/constexpr-dynamic6.C: Likewise. * g++.dg/cpp2a/constexpr-dynamic7.C: Likewise. * g++.dg/cpp2a/constexpr-dynamic8.C: Likewise. * g++.dg/cpp2a/constexpr-dynamic9.C: Likewise. * g++.dg/cpp2a/constexpr-dynamic11.C: Likewise. * g++.dg/cpp2a/constexpr-dynamic14.C: Likewise. * g++.dg/cpp2a/constexpr-dynamic18.C: Likewise. * g++.dg/cpp2a/constexpr-new27.C: New test. * g++.dg/cpp2a/constexpr-typeid5.C: New test. libstdc++-v3/ * include/bits/version.def (constexpr_exceptions): New. * include/bits/version.h: Regenerate. * libsupc++/exception (std::bad_exception::bad_exception): Add _GLIBCXX26_CONSTEXPR. (std::bad_exception::~bad_exception, std::bad_exception::what): For C++26 add constexpr and define inline. * libsupc++/exception.h (std::exception::exception, std::exception::operator=): Add _GLIBCXX26_CONSTEXPR. (std::exception::~exception, std::exception::what): For C++26 add constexpr and define inline. * libsupc++/exception_ptr.h (std::make_exception_ptr): Add _GLIBCXX26_CONSTEXPR. For if consteval use just throw with current_exception() in catch. (std::exception_ptr::exception_ptr(void*)): For C++26 add constexpr and define inline. (std::exception_ptr::exception_ptr()): Add _GLIBCXX26_CONSTEXPR. (std::exception_ptr::exception_ptr(const exception_ptr&)): Likewise. Use __builtin_eh_ptr_adjust_ref if consteval and compiler has it instead of _M_addref. (std::exception_ptr::exception_ptr(nullptr_t)): Add _GLIBCXX26_CONSTEXPR. (std::exception_ptr::exception_ptr(exception_ptr&&)): Likewise. (std::exception_ptr::operator=): Likewise. (std::exception_ptr::~exception_ptr): Likewise. Use __builtin_eh_ptr_adjust_ref if consteval and compiler has it instead of _M_release. (std::exception_ptr::swap): Add _GLIBCXX26_CONSTEXPR. (std::exception_ptr::operator bool): Likewise. (std::exception_ptr::operator==): Likewise. * libsupc++/nested_exception.h (std::nested_exception::nested_exception): Add _GLIBCXX26_CONSTEXPR. (std::nested_exception::operator=): Likewise. (std::nested_exception::~nested_exception): For C++26 add constexpr and define inline. (std::nested_exception::rethrow_if_nested): Add _GLIBCXX26_CONSTEXPR. (std::nested_exception::nested_ptr): Likewise. (std::_Nested_exception::_Nested_exception): Likewise. (std::throw_with_nested, std::rethrow_if_nested): Likewise. * libsupc++/new (std::bad_alloc::bad_alloc): Likewise. (std::bad_alloc::operator=): Likewise. (std::bad_alloc::~bad_alloc): For C++26 add constexpr and define inline. (std::bad_alloc::what): Likewise. (std::bad_array_new_length::bad_array_new_length): Add _GLIBCXX26_CONSTEXPR. (std::bad_array_new_length::~bad_array_new_length): For C++26 add constexpr and define inline. (std::bad_array_new_length::what): Likewise. * libsupc++/typeinfo (std::bad_cast::bad_cast): Add _GLIBCXX26_CONSTEXPR. (std::bad_cast::~bad_cast): For C++26 add constexpr and define inline. (std::bad_cast::what): Likewise. (std::bad_typeid::bad_typeid): Add _GLIBCXX26_CONSTEXPR. (std::bad_typeid::~bad_typeid): For C++26 add constexpr and define inline. (std::bad_typeid::what): Likewise.
9 daysChange bellow in comments to belowJakub Jelinek1-2/+2
While I'm not a native English speaker, I believe all the uses of bellow (roar/bark/...) in comments in gcc are meant to be below (beneath/under/...). 2025-07-10 Jakub Jelinek <jakub@redhat.com> gcc/ * tree-vect-loop.cc (scale_profile_for_vect_loop): Comment spelling fix: bellow -> below. * ipa-polymorphic-call.cc (record_known_type): Likewise. * config/i386/x86-tune.def: Likewise. * config/riscv/vector.md (*vsetvldi_no_side_effects_si_extend): Likewise. * tree-scalar-evolution.cc (iv_can_overflow_p): Likewise. * ipa-devirt.cc (add_type_duplicate): Likewise. * tree-ssa-loop-niter.cc (maybe_lower_iteration_bound): Likewise. * gimple-ssa-sccopy.cc: Likewise. * cgraphunit.cc: Likewise. * graphite.h (struct poly_dr): Likewise. * ipa-reference.cc (ignore_edge_p): Likewise. * tree-ssa-alias.cc (ao_compare::compare_ao_refs): Likewise. * profile-count.h (profile_probability::probably_reliable_p): Likewise. * ipa-inline-transform.cc (inline_call): Likewise. gcc/ada/ * par-load.adb: Comment spelling fix: bellow -> below. * libgnarl/s-taskin.ads: Likewise. gcc/testsuite/ * gfortran.dg/g77/980310-3.f: Comment spelling fix: bellow -> below. * jit.dg/test-debuginfo.c: Likewise. libstdc++-v3/ * testsuite/22_locale/codecvt/codecvt_unicode.h (ucs2_to_utf8_out_error): Comment spelling fix: bellow -> below. (utf16_to_ucs2_in_error): Likewise.
9 daysDaily bump.GCC Administrator1-0/+64
9 dayslibstdc++: Fix __uninitialized_default for constexpr caseJonathan Wakely1-1/+7
We should not use the std::fill optimization for trivial types during constant evaluation, because we need to begin the lifetime of all objects, even trivially default constructible ones. This fixes a bug that Clang diagnosed: include/c++/16.0.0/bits/stl_algobase.h:925:11: note: assignment to object outside its lifetime is not allowed in a constant expression 925 | *__first = __val; | ~~~~~~~~~^~~~~~~ I initially just added the #ifdef __cpp_lib_is_constant_evaluated check, but that gave warnings with GCC because the function isn't constexpr until C++26. So then I tried checking __glibcxx_raw_memory_algorithms for the value indicating constexpr uninitialized_value_construct, but that macro depends on __cpp_constexpr >= 202406 and Clang 19 doesn't support constexpr placement new, so doesn't define it. So I decided to just change __uninitialized_default to use _GLIBCXX20_CONSTEXPR which is consistent with __uninitialized_default_n (which needs to be constexpr because it's used by std::vector). We don't currently need to use __uninitialized_default in constexpr contexts for C++20 code, but we might find uses for it, so now it would be possible. libstdc++-v3/ChangeLog: * include/bits/stl_uninitialized.h (__uninitialized_default): Do not use optimized implementation for constexpr case. Use _GLIBCXX20_CONSTEXPR instead of _GLIBCXX26_CONSTEXPR.
9 dayslibstdc++: Add more template keywords to <mdspan> for ClangJonathan Wakely1-2/+2
This fixes: include/c++/16.0.0/mdspan:1182:33: error: use 'template' keyword to treat 'mapping' as a dependent template name 1182 | const typename _OLayout::mapping<_OExtents>&> | ^ include/c++/16.0.0/mdspan:1185:31: error: use 'template' keyword to treat 'mapping' as a dependent template name 1185 | const typename _OLayout::mapping<_OExtents>&, mapping_type> | ^ libstdc++-v3/ChangeLog: * include/std/mdspan (mdspan): Add template keyword for dependent name.
9 dayslibstdc++: Do not use list-initialization in std::span members [PR120997]Jonathan Wakely2-7/+54
As the bug report shows, for span<const bool> the return statements of the form `return {data(), count};` will use the new C++26 constructor, span(initializer_list<element_type>). Although the conversions from data() to bool and count to bool are narrowing and should be ill-formed, in system headers the narrowing diagnostics are suppressed. In any case, even if the compiler diagnosed them as ill-formed, we still don't want the initializer_list constructor to be used. We want to use the span(element_type*, size_t) constructor instead. Replace the braced-init-list uses with S(data(), count) where S is the correct return type. We need to make similar changes in the C++26 working draft, which will be taken care of via an LWG issue. libstdc++-v3/ChangeLog: PR libstdc++/120997 * include/std/span (span::first, span::last, span::subspan): Do not use braced-init-list for return statements. * testsuite/23_containers/span/120997.cc: New test.
10 dayslibstdc++: Add smart ptr owner_equals and owner_hash [PR117403]Paul Keir14-0/+616
New structs and member functions added to C++26 by P1901R2. libstdc++-v3/ChangeLog: PR libstdc++/117403 * include/bits/shared_ptr.h (shared_ptr::owner_equal) (shared_ptr::owner_hash, weak_ptr::owner_equal) (weak_ptr::owner_hash): Define new member functions. * include/bits/shared_ptr_base.h (owner_equal, owner_hash): Define new structs. * include/bits/version.def (smart_ptr_owner_equality): Define. * include/bits/version.h: Regenerate. * include/std/memory: Added define for __glibcxx_want_smart_ptr_owner_equality. * testsuite/20_util/owner_equal/version.cc: New test. * testsuite/20_util/owner_equal/cmp.cc: New test. * testsuite/20_util/owner_equal/noexcept.cc: New test. * testsuite/20_util/owner_hash/cmp.cc: New test. * testsuite/20_util/owner_hash/noexcept.cc: New test. * testsuite/20_util/shared_ptr/observers/owner_equal.cc: New test. * testsuite/20_util/shared_ptr/observers/owner_hash.cc: New test. * testsuite/20_util/weak_ptr/observers/owner_equal.cc: New test. * testsuite/20_util/weak_ptr/observers/owner_hash.cc: New test. Signed-off-by: Paul Keir <paul.keir@uws.ac.uk>
10 dayslibstdc++: Added missing members to numeric_limits specializations for ↵Mateusz Zych2-0/+114
integer-class types [iterator.concept.winc]/11 says that std::numeric_limits should be specialized for integer-class types, with each member defined appropriately. libstdc++-v3/ChangeLog: * include/bits/max_size_type.h (numeric_limits<__max_size_type>): New members. (numeric_limits<__max_diff_type>): Likewise. * testsuite/std/ranges/iota/max_size_type.cc: New test cases. Signed-off-by: Mateusz Zych <mte.zych@gmail.com>
10 dayslibstdc++: Fix memory_resource.cc bootstrap failure for non-gthreads targetsJonathan Wakely2-27/+40
The new choose_block_size function added in r16-2112-gac2fb60a67d6d1 was defined inside an #ifdef _GLIBCXX_HAS_GTHREADS group, which means that it's not available for single-threaded targets, and so can't be used by unsynchronized_pool_resource. Move it before that preprocessor group so it's always defined. libstdc++-v3/ChangeLog: * src/c++17/memory_resource.cc: Adjust indentation of unnamed namespaces. (pool_sizes): Add comment. (choose_block_size): Move outside preprocessor group for gthreads targets. * testsuite/20_util/synchronized_pool_resource/118681.cc: Require gthreads.
10 dayslibstdc++: Update some baseline_symbols.txt (x32)H.J. Lu1-0/+11
* config/abi/post/x86_64-linux-gnu/x32/baseline_symbols.txt: Updated. Signed-off-by: H.J. Lu <hjl.tools@gmail.com>