diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2024-10-22 16:06:12 +0100 |
---|---|---|
committer | Jonathan Wakely <redi@gcc.gnu.org> | 2024-10-24 17:22:33 +0100 |
commit | 0dbc588acaa27a3a56bc9173bd577e1293f10046 (patch) | |
tree | a415cc21c565754dfe60e87df952909f9e8f8183 /maintainer-scripts/branch_changer.py | |
parent | bf43fe6aa966eaf397ea3b8ebd6408d3d124e285 (diff) | |
download | gcc-0dbc588acaa27a3a56bc9173bd577e1293f10046.zip gcc-0dbc588acaa27a3a56bc9173bd577e1293f10046.tar.gz gcc-0dbc588acaa27a3a56bc9173bd577e1293f10046.tar.bz2 |
libstdc++: Simplify std::__throw_bad_variant_access
This removes the overload of __throw_bad_variant_access that must be
called with a string literal. This avoids a potential source of
undefined behaviour if that function got misused. The other overload
that takes a bool parameter can be adjusted to take an integer index
selecting one of the four possible string literals to use, ensuring
that the std::bad_variant_access constructor is only called with those
literals.
Passing an index outside the range [0,3] is bogus, but will still select
a valid string literal and avoid undefined behaviour.
libstdc++-v3/ChangeLog:
* include/std/variant (__throw_bad_variant_access(unsigned)):
Define new function as inline friend, with namespace-scope
declaration using noreturn attribute.
(__throw_bad_variant_access(const char*)): Remove.
(__throw_bad_variant_access(bool)): Remove.
(visit, visit<R>): Adjust calls to __throw_bad_variant_access.
Reviewed-by: Patrick Palka <ppalka@redhat.com>
Diffstat (limited to 'maintainer-scripts/branch_changer.py')
0 files changed, 0 insertions, 0 deletions