Skip to content

Commit b6c37b1

Browse files
burblebeetkoeppe
authored andcommitted
CWG2815 Overload resolution for references/pointers to noexcept functions
1 parent 97837d7 commit b6c37b1

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

source/overloading.tex

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2329,16 +2329,16 @@
23292329

23302330
\item
23312331
Otherwise,
2332-
if \tcode{T} is a function type, or
23332332
if the type of the argument is possibly cv-qualified \tcode{T}, or
23342333
if \tcode{T} is an array type of unknown bound with element type \tcode{U} and
23352334
the argument has an array type of known bound whose
23362335
element type is possibly cv-qualified \tcode{U},
23372336
the implicit conversion sequence is the identity conversion.
2338-
\begin{note}
2339-
When \tcode{T} is a function type,
2340-
the type of the argument can differ only by the presence of \keyword{noexcept}.
2341-
\end{note}
2337+
2338+
\item
2339+
Otherwise,
2340+
if \tcode{T} is a function type,
2341+
the implicit conversion sequence is a function pointer conversion.
23422342

23432343
\item
23442344
Otherwise, the implicit conversion sequence is a qualification conversion.
@@ -2351,6 +2351,11 @@
23512351
int f(A&);
23522352
int f(B&);
23532353
int i = f(b); // calls \tcode{f(B\&)}, an exact match, rather than \tcode{f(A\&)}, a conversion
2354+
2355+
void g() noexcept;
2356+
int h(void (&)() noexcept); // \#1
2357+
int h(void (&)()); // \#2
2358+
int j = h(g); // calls \#1, an exact match, rather than \#2, a function pointer conversion
23542359
\end{codeblock}
23552360
\end{example}
23562361
If the parameter binds directly to the result of
@@ -2835,15 +2840,11 @@
28352840
b.f(); // calls \tcode{X::f()}
28362841
}
28372842

2838-
int h1(int (&)[]);
2839-
int h1(int (&)[1]);
2840-
int h2(void (&)());
2841-
int h2(void (&)() noexcept);
2843+
int h(int (&)[]);
2844+
int h(int (&)[1]);
28422845
void g2() {
28432846
int a[1];
2844-
h1(a); // calls \tcode{h1(int (\&)[1])}
2845-
extern void f2() noexcept;
2846-
h2(f2); // calls \tcode{h2(void (\&)() noexcept)}
2847+
h(a); // calls \tcode{h(int (\&)[1])}
28472848
}
28482849
\end{codeblock}
28492850
\end{example}

0 commit comments

Comments
 (0)