diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2021-06-14 20:31:00 +0100 |
---|---|---|
committer | Jonathan Wakely <jwakely@redhat.com> | 2021-06-14 21:17:53 +0100 |
commit | c37b5ddcc88e0cc0f6a4ad609eda51021df0f6bb (patch) | |
tree | f038a183eb9ab811e71228d68a8e2ad8bf885cdc /gcc/builtins.c | |
parent | 4986946f3b761dd4c3e0d79ca735c90e33f4bb83 (diff) | |
download | gcc-c37b5ddcc88e0cc0f6a4ad609eda51021df0f6bb.zip gcc-c37b5ddcc88e0cc0f6a4ad609eda51021df0f6bb.tar.gz gcc-c37b5ddcc88e0cc0f6a4ad609eda51021df0f6bb.tar.bz2 |
libstdc++: Fix common_reference for non-reference results [PR100894]
The result of COMMON-REF(A&, B&&) where they have no common reference
type should not be a reference. The implementation of COMMON-REF fails
to check that the result is a reference, so is well-formed when it
shouldn't be. This means that common_reference uses that result when it
shouldn't.
The fix is to reject the result of COMMON-REF(A, B) if it's not a
reference, so that common_reference falls through to the next case,
which uses COND-RES, which yields a non-reference result.
Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
libstdc++-v3/ChangeLog:
PR libstdc++/100894
* include/std/type_traits (__common_ref_impl<X&, Y&>): Only
use the type if it's a reference.
* testsuite/20_util/common_reference/100894.cc: New test.
Diffstat (limited to 'gcc/builtins.c')
0 files changed, 0 insertions, 0 deletions