Skip to content

[temp.pre] Fix note about uniqueness of a template name in a scope #7284

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

Merged
merged 1 commit into from
Nov 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions source/templates.tex
Original file line number Diff line number Diff line change
@@ -143,12 +143,26 @@
\begin{note}
A template cannot have the same name as any other
name bound in the same scope\iref{basic.scope.scope}, except
that a function template can share a name with non-template
functions\iref{dcl.fct} and/or function templates\iref{temp.over}.
that a function template can share a name with \grammarterm{using-declarator}s,
a type, non-template functions\iref{dcl.fct} and/or function templates\iref{temp.over}.
Specializations, including partial specializations\iref{temp.spec.partial},
do not reintroduce or bind names.
Their target scope is the target scope of the primary template,
so all specializations of a template belong to the same scope as it does.
\begin{example}
\begin{codeblock}
void f() {}
class f {}; // OK
namespace N {
void f(int) {}
}
using N::f; // OK
template<typename> void f(long) {} // \#1, OK
template<typename> void f(long) {} // error: redefinition of \#1
template<typename> void f(long long) {} // OK
template<> void f<int>(long long) {} // OK, doesn't bind a name
\end{codeblock}
\end{example}
\end{note}

\pnum
Loading