[Bug c++/99664] Overriding virtual function with different return type (and not covariant) is allowed to compile, when it shouldn’t be
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Jul 16 20:21:38 GMT 2021
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99664
--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>:
https://gcc.gnu.org/g:d04b0c75794545f1f7a942764285e21eaf2915a1
commit r12-2377-gd04b0c75794545f1f7a942764285e21eaf2915a1
Author: Patrick Palka <ppalka@redhat.com>
Date: Fri Jul 16 16:21:10 2021 -0400
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.
More information about the Gcc-bugs
mailing list