mirror of
https://github.com/gcc-mirror/gcc.git
synced 2026-05-06 14:59:39 +02:00
7793e34adfa05a4a9868647e0fba8f088100c142
The _Arg_value::_M_set method, initialized the union member, by assigning to reference to that member produced by _M_get(*this). However, per language rules, such assignment has undefined behavior, if alternative was not already active, same as for any object not within its lifetime. To address above, we modify _M_set to use placement new for the class types, and invoke _S_access with two arguments for all other types. The _S_access (rename of _S_get) is modified to assign the value of the second parameter (if provided) to the union member. Such direct assignments are treated specially in the language (see N5032 [class.union.general] p5), and will start lifetime of trivially default constructible alternative. libstdc++-v3/ChangeLog: * include/std/format (_Arg_value::_M_get): Rename to... (_Arg_value::_M_access): Modified to accept optional second parameter that is assigned to value. (_Arg_value::_M_get): Handle rename. (_Arg_value::_M_set): Use construct_at for basic_string_view, handle, and two-argument _S_access for other types. Reviewed-by: Jonathan Wakely <jwakely@redhat.com> Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com> Signed-off-by: Ivan Lazaric <ivan.lazaric1@gmail.com> Co-authored-by: Ivan Lazaric <ivan.lazaric1@gmail.com>
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
This directory contains the GNU Compiler Collection (GCC). The GNU Compiler Collection is free software. See the files whose names start with COPYING for copying permission. The manuals, and some of the runtime libraries, are under different terms; see the individual source files for details. The directory INSTALL contains copies of the installation information as HTML and plain text. The source of this information is gcc/doc/install.texi. The installation information includes details of what is included in the GCC sources and what files GCC installs. See the file gcc/doc/gcc.texi (together with other files that it includes) for usage and porting information. An online readable version of the manual is in the files gcc/doc/gcc.info*. See http://gcc.gnu.org/bugs/ for how to report bugs usefully. Copyright years on GCC source files may be listed using range notation, e.g., 1987-2012, indicating that every year in the range, inclusive, is a copyrightable year that could otherwise be listed individually.
Description
Languages
C++
30.7%
C
30.2%
Ada
14.4%
D
6.1%
Go
5.7%
Other
12.4%