Skip to content
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
Expand Up @@ -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
Expand Down
Loading