Skip to content

Commit 520aa07

Browse files
burblebeetkoeppe
authored andcommitted
CWG2789 Overload resolution with implicit and explicit object member functions
1 parent 05ac6f7 commit 520aa07

File tree

1 file changed

+28
-3
lines changed

1 file changed

+28
-3
lines changed

source/overloading.tex

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1786,10 +1786,35 @@
17861786
or, if not that,
17871787

17881788
\item
1789-
\tcode{F1} and \tcode{F2} are non-template functions with the same
1790-
parameter-type-lists, and \tcode{F1} is more constrained than \tcode{F2}
1789+
\tcode{F1} and \tcode{F2} are non-template functions and
1790+
\begin{itemize}
1791+
\item
1792+
they have the same non-object-parameter-type-lists\iref{dcl.fct}, and
1793+
\item
1794+
if they are member functions, both are direct members of the same class, and
1795+
\item
1796+
if both are non-static member functions,
1797+
they have the same types for their object parameters, and
1798+
\item
1799+
\tcode{F1} is more constrained than \tcode{F2}
17911800
according to the partial ordering of constraints described in
1792-
\ref{temp.constr.order}, or if not that,
1801+
\ref{temp.constr.order},
1802+
\end{itemize}
1803+
or if not that,
1804+
\begin{example}
1805+
\begin{codeblock}
1806+
template <typename T = int>
1807+
struct S {
1808+
constexpr void f(); // \#1
1809+
constexpr void f(this S&) requires true; // \#2
1810+
};
1811+
1812+
void test() {
1813+
S<> s;
1814+
s.f(); // calls \#2
1815+
}
1816+
\end{codeblock}
1817+
\end{example}
17931818

17941819
\item
17951820
\tcode{F1} is a constructor for a class \tcode{D},

0 commit comments

Comments
 (0)