]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: covariant reference return types [PR99664]
authorPatrick Palka <ppalka@redhat.com>
Fri, 16 Jul 2021 20:21:10 +0000 (16:21 -0400)
committerPatrick Palka <ppalka@redhat.com>
Fri, 16 Jul 2021 20:21:10 +0000 (16:21 -0400)
commitd04b0c75794545f1f7a942764285e21eaf2915a1
treeb6d7e09642e68a99009793d8e96486d9578fe91f
parent9faf8348621ae6ab583af593d67ac424300a2bad
c++: covariant reference return types [PR99664]

This implements the wording changes of CWG 960 which clarifies that two
reference types are covariant only if they're both lvalue references
or both rvalue references.

DR 960
PR c++/99664

gcc/cp/ChangeLog:

* search.c (check_final_overrider): Compare TYPE_REF_IS_RVALUE
when the return types are references.

gcc/testsuite/ChangeLog:

* g++.dg/inherit/covariant23.C: New test.
gcc/cp/search.c
gcc/testsuite/g++.dg/inherit/covariant23.C [new file with mode: 0644]