You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Issue description: Currently the wording in [temp.explicit] does not allow for empty <> to be omitted when all of the template arguments can be obtained from the default arguments. Additionally, it also does not allow for the trailing template argument to be left unspecified if it can be obtained from default argument. The below example shows the issue:
template<class T> class Array { /* ... */ };
template<class T, typename U = double> void sort(Array<T>& v) { /* ... */ }
template void sort<>(Array<int>&); //ill-formed as per current wording
template void sort(Array<double>&); //ill-formed as per current wording
A trailing template-argument can be left unspecified in an explicit instantiation of a function template specialization or of a member function template specialization provided it can be deduced ([temp.deduct.decl]).
If all template arguments can be deduced, the empty template argument list <> may be omitted.
Suggested resolution:
Change [temp.explicit#8] to as indicated/highlighted below:
A trailing template-argument can be left unspecified in an explicit instantiation of a function template specialization or of a member function template specialization provided it can be deduced ([temp.deduct.decl]).or obtained from default template-arguments. If all template arguments can be deduced or obtained from default template-arguments, the empty template argument list <> may be omitted.
After the suggested changes, the two statements(involving explicit instantiation) will be well-formed.
The text was updated successfully, but these errors were encountered:
@jensmaurer Yes, It(temp.explicit#8) does seem redundant. Maybe we should remove that paragraph and just update the example given there to as shown below. This can be then editorial perhaps.
jensmaurer
changed the title
[temp.explicit] Allowing ommiting empty template argument list for default arguments during explicit instantiation
[temp.explicit] Allowing omitting empty template argument list for default arguments during explicit instantiation
Jan 30, 2024
jensmaurer
changed the title
[temp.explicit] Allowing omitting empty template argument list for default arguments during explicit instantiation
CWG2848 [temp.explicit] Allowing omitting empty template argument list for default arguments during explicit instantiation
Jan 30, 2024
Full name of submitter: Anoop Rana
Reference (section label): [temp.explicit]
Issue description: Currently the wording in [temp.explicit] does not allow for empty
<>
to be omitted when all of the template arguments can be obtained from the default arguments. Additionally, it also does not allow for the trailing template argument to be left unspecified if it can be obtained from default argument. The below example shows the issue:The current wording in temp.explicit#8 states:
Suggested resolution:
Change [temp.explicit#8] to as indicated/highlighted below:
After the suggested changes, the two statements(involving explicit instantiation) will be well-formed.
The text was updated successfully, but these errors were encountered: