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

CWG2958 [over.ics.rank] Incorrect Example of Overload Resolution with Qualification Conversion #639

Open
ckwastra opened this issue Nov 10, 2024 · 3 comments

Comments

@ckwastra
Copy link

Full name of submitter: Vincent X

Reference: [over.ics.rank]

Issue description: In Example 5:

int g(const int*);                 // (1)
int g(const volatile int* const&); // (2)
int* p;
int k = g(p);                   // calls g(const int*)

(1) involves an lvalue-to-rvalue conversion followed by a qualification conversion, whereas (2) only requires a qualification conversion. Since [over.ics.rank]/3.2.5 assumes:

S1 and S2 differ only in their qualification conversion ([conv.qual]) [...]

This call should be ambiguous. This issue was initially discussed on Slack. The above example was introduced in CWG2803.

Suggested resolution: Modify the example as follows:

int g(const int* const&); 
int g(const volatile int* const&);
int* p;
int k = g(p);                   // calls g(const int* const&)
@jensmaurer
Copy link
Member

I think fixing the example is not what we want. Instead, we want the normative words to reflect the intent expressed in the example.

@t3nsor
Copy link

t3nsor commented Nov 11, 2024

I think we could just borrow the "excluding any lvalue transformation" wording from p3.2.1.

@jensmaurer
Copy link
Member

CWG2958

@jensmaurer jensmaurer changed the title [over.ics.rank] Incorrect Example of Overload Resolution with Qualification Conversion CWG2958 [over.ics.rank] Incorrect Example of Overload Resolution with Qualification Conversion Nov 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants