https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100894

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jonathan Wakely <r...@gcc.gnu.org>:

https://gcc.gnu.org/g:c37b5ddcc88e0cc0f6a4ad609eda51021df0f6bb

commit r12-1437-gc37b5ddcc88e0cc0f6a4ad609eda51021df0f6bb
Author: Jonathan Wakely <jwak...@redhat.com>
Date:   Mon Jun 14 20:31:00 2021 +0100

    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 <jwak...@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.

Reply via email to