This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 116a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2024-12-19
According to 6.4.1 [basic.scope.scope] paragraph 3,
Two declarations correspond if they (re)introduce the same name, both declare constructors, or both declare destructors, unless
...
each declares a function or function template, except when
both declare functions with the same parameter-type-list,21 equivalent (13.7.7.2 [temp.over.link]) trailing requires-clauses (if any, except as specified in 13.7.5 [temp.friend]), and, if both are non-static members, the same cv-qualifiers (if any) and ref-qualifier (if both have one), or
...
This would indicate that a virtual function (which cannot have a trailing requires-clause, per 11.7.3 [class.virtual] paragraph 6) can be overloaded with a non-virtual member function with the same parameter type list but with a trailing requires-clause. However, this is not implementable on some ABIs, since the mangling of the two functions would be the same. For example:
#include <type_traits> template<class T> struct Foo { virtual void fun() const {} void fun() const requires std::is_object_v<T> {} }; int main() { Foo<int>{}.fun(); }
Should such overloading be ill-formed or conditionally-supported, or should the current rules be kept?
Rationale (August, 2021):
CWG felt that the current rules are correct; it simply means that only the virtual function can be called, and all other references are simply ambiguous. (See also issue 2501 for a related question dealing with explicit instantiation.
Notes from the November, 2021 teleconference:
The issue has been reopened in response to additional discussion.
CWG 2022-11-11
This is related to issue 2501. CWG solicits a paper to address this issue.