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

[dcl.meaning.general] p3.3 The lookup for the declarator-id that is an identifier in the explicit instantiation or specialization for function template #5496

Open
xmh0511 opened this issue May 27, 2022 · 0 comments

Comments

@xmh0511
Copy link
Contributor

xmh0511 commented May 27, 2022

If the declarator declares an explicit instantiation or a partial or explicit specialization, the declarator does not bind a name. If it declares a class member, the terminal name of the declarator-id is not looked up; otherwise, only those lookup results that are nominable in S are considered when identifying any function template specialization being declared ([temp.deduct.decl]).

Consider this example:

void fun(int*, void*);  // #1

template<class T, class U>
void fun(T*, U*);   // #2

template<>
void fun(int*, void*);  // #3

We do not restrict more requirements on the name lookup for fun. The result should consist of #1 and #2. [temp.deduct.decl] p1 says

In a declaration whose declarator-id refers to a specialization of a function template, template argument deduction is performed to identify the specialization to which the declaration refers.

It is not clear whether the declarator-id that is an identifier refers to a specialization of a function template or not. We just say

A template specialization can be referred to by a template-id

in [temp.names] p1. The identifier refers to a specialization only if the deduction succeeds, I think. [temp.deduct.decl] p1 also says

In all these cases, P is the type of the function template being considered as a potential match...

This implies that only function templates are considered when identifying any function template specialization.

[dcl.meaning.general] p3.3 might be changed to

otherwise, only those lookup results that are function templates and are nominable in S are considered when identifying any function template specialization being declared ([temp.deduct.decl]).

change [temp.deduct.decl] p1 to

In explicit instantiations, explicit specializations, and certain friend declarations, template argument deduction is performed to identify the template of which the specialization is being declared/instantiated by the declaration.

@xmh0511 xmh0511 changed the title [dcl.meaning.general] p3.3 The lookup for the declarator-id that is an identifier in the explicit instantiation or a partial or explicit specializatio [dcl.meaning.general] p3.3 The lookup for the declarator-id that is an identifier in the explicit instantiation or specialization for function template May 29, 2022
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

1 participant