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

ADL for cv T or T& #3896

Open
opensdh opened this issue Mar 24, 2020 · 5 comments
Open

ADL for cv T or T& #3896

opensdh opened this issue Mar 24, 2020 · 5 comments
Labels
cwg Issue must be reviewed by CWG. not-editorial Issue is not deemed editorial; the editorial issue is kept open for tracking.

Comments

@opensdh
Copy link
Contributor

opensdh commented Mar 24, 2020

[basic.lookup.argdep] never considers that T might be cv-qualified; now that [concept.booleantestable]/2.2 sends decltype((e)) to "ADL", it might also be a reference type. The intent here is obviously to ignore such decorations; can that be done editorially?

@timsong-cpp
Copy link
Contributor

It already could be a reference type from a template argument, no?

@opensdh
Copy link
Contributor Author

opensdh commented Mar 24, 2020

@timsong-cpp: True—and we also consider function parameter and return types, so this is entirely preexisting.

@zygoloid zygoloid added cwg Issue must be reviewed by CWG. not-editorial Issue is not deemed editorial; the editorial issue is kept open for tracking. labels Mar 31, 2020
@zygoloid
Copy link
Member

I think [basic.lookup.argdep] is fine for cv-qualified types. Cv-qualified types are versions of their cv-unqualified types, and so are of the same categories (eg, int *const is a pointer type). So I think only the reference-type portion is in scope here. For

namespace N {
    struct X {};
    void f(void (N::X&));
}
void g(N::X&);
void h() { f(g); }

I think the language rules are clear that the call is ill-formed, but all implementations accept. I can't bring myself to see fixing this as being editorial; please file a core issue (and let us know when that's done so this can be closed).

@zygoloid zygoloid reopened this Mar 31, 2020
@opensdh
Copy link
Contributor Author

opensdh commented Mar 31, 2020

Cv-qualified types are versions of their cv-unqualified types, and so are of the same categories (eg, int *const is a pointer type).

I don't think we state that clearly; for example, [basic.types]/9 says that

Arithmetic types (6.8.1), enumeration types, pointer types, pointer-to-member types (6.8.2), std::nullptr_t, and cv-qualified (6.8.3) versions of these types are collectively called scalar types.

and [basic.fundamental]/1 says that there are 5 (not 20) standard signed integer types.

Am I misinterpreting [basic.types], or do we need some sort of correction there if not in [basic.lookup.argdep]?

@languagelawyer
Copy link
Contributor

languagelawyer commented May 3, 2020

[basic.fundamental]/1 says that there are 5 (not 20) standard signed integer types

[class.name]/1 says «A class definition introduces a new type». Shouldn't it say that 4 types are introduced?

Also, shall const T class type have the same members as T? [basic.type.qualifier]/1 only says that const T shall have the same representation and alignment requirement as T, but this doesn't prohibit rename of members (say, from N to c_N) and/or addition of qualifiers to their types. (https://stackoverflow.com/questions/61568349/decltype-of-qualified-id-denoting-class-member-with-const-t-vs-t-in-nested-name-specifier)

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. not-editorial Issue is not deemed editorial; the editorial issue is kept open for tracking.
Projects
None yet
Development

No branches or pull requests

4 participants