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

Several rules conflict with the modification of P1971 #4844

Closed
xmh0511 opened this issue Aug 27, 2021 · 3 comments
Closed

Several rules conflict with the modification of P1971 #4844

xmh0511 opened this issue Aug 27, 2021 · 3 comments

Comments

@xmh0511
Copy link
Contributor

xmh0511 commented Aug 27, 2021

As the modification P1971 and it had merged in the current draft
[dcl.decl#general-4]

The optional requires-clause ([temp.pre]) in an init-declarator or member-declarator shall be present only if the declarator declares a templated function ([dcl.fct]).

This rule requires that the trailing requires-clause should be only used in a declaration of a template-declaration.

Consider these several rules that has conflicted with this modification

[basic.scope#scope-3.3.1]

both declare functions with the same parameter-type-list,21 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), or

[over.over#5]

Any given non-template function F0 is eliminated if the set contains a second non-template function that is more constrained than F0 according to the partial ordering rules of [temp.constr.order].

If it is a non-template function, how could it has a constraint as per [dcl.decl#general-4]. As far as now, I find out these contradictions located in these rules. Maybe, there is more in somewhere.

@cpplearner
Copy link
Contributor

A member function of a class template is a templated function. ([temp.pre]/8)

@xmh0511
Copy link
Contributor Author

xmh0511 commented Aug 27, 2021

A member function of a class template is a templated function. ([temp.pre]/8)

However, that rule not only applies to the member function of a class template but also non-member function. We should restrict that "if it is templated" as a condition. Moreover, non-template function is defined as:

A non-template function is not related to a function template (i.e., it is never considered to be a specialization), even if it has the same name and type as a potentially generated function template specialization.128

I don't know whether the specialization in the parenthesis only refers to the specialization of a function template or it also refers to the specialization of a member function of a class template. However, the rules say it is not related to a function template instead of templated function, which means specialization of a member function of a class template and common function all can be called non-template function. Hence, the above opinion is also suitable for it.

@xmh0511
Copy link
Contributor Author

xmh0511 commented Aug 27, 2021

After further consideration. I think [basic.scope#scope-3.3.1] is sufficient here since the "if any". [over.over#5] is arguably right since it only applies to member function with constraints.

@xmh0511 xmh0511 closed this as completed Aug 27, 2021
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

2 participants