Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Description for two non-static member declarations to determine whether they correspond #4546

Closed
xmh0511 opened this issue Mar 15, 2021 · 2 comments
Labels
cwg Issue must be reviewed by CWG.

Comments

@xmh0511
Copy link
Contributor

xmh0511 commented Mar 15, 2021

The basic.scope#scope-3.3.1 says

both declare functions with the same parameter-type-list, equivalent ([temp.over.link]) trailing requires-clauses (if any, except as specified in [temp.friend]), and, if both are non-static members, the same cv-qualifiers (if any) and ref-qualifier (if both have one)

The above rule could be understood to, For two non-static member functions with the same parameter-type-list, if anyone has a cv-qualifiers then both declarations should have the same cv-qualifiers; if both declarations have ref-qualifier, they should have the same ref-qualifier. Otherwise, they do not correspond.

struct A{
    void show();  //#1
    void show() const &;  //#2
};

In this snippet, Does #1 correspond to #2? Since #2 has a cv-qualifier but #1 does not have, even if the condition for having the same ref-qualifier is true, as per the rule(note the emphasized and in that rule), they do not correspond. So why couldn't they overload if per the draft? After all, the section over.load#2.3 was removed by P1787.

@xmh0511 xmh0511 changed the title Description about two non-static member declarations that correspond Description for two non-static member declarations to determine whether they correspond Mar 15, 2021
@jensmaurer
Copy link
Member

jensmaurer commented Mar 15, 2021

That looks like a core issue to me.

http://lists.isocpp.org/core/2021/03/10637.php

@jensmaurer jensmaurer added the cwg Issue must be reviewed by CWG. label Mar 15, 2021
@jensmaurer
Copy link
Member

This arrived with P1787R6. The wording thus is new, and compilers haven't caught up yet.

https://lists.isocpp.org/core/2020/11/10201.php

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cwg Issue must be reviewed by CWG.
Projects
None yet
Development

No branches or pull requests

2 participants