Skip to content

Commit df3e381

Browse files
author
Dawn Perchik
committed
CWG1781 Converting from nullptr_t to bool in overload resolution
Also fixes CWG2133.
1 parent c440d18 commit df3e381

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

source/declarations.tex

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4356,6 +4356,11 @@
43564356
If the conversion cannot be done or is
43574357
ambiguous, the initialization is ill-formed.
43584358
\item
4359+
Otherwise, if the initialization is direct-initialization,
4360+
the source type is \tcode{std::nullptr_t}, and
4361+
the destination type is \tcode{bool},
4362+
the initial value of the object being initialized is \tcode{false}.
4363+
\item
43594364
Otherwise, the initial value of the object being initialized is
43604365
the (possibly converted) value of the initializer expression.
43614366
Standard conversions\iref{conv} will be used, if necessary,

source/expressions.tex

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,10 +1068,7 @@
10681068
A prvalue of arithmetic, unscoped enumeration, pointer, or pointer-to-member
10691069
type can be converted to a prvalue of type \tcode{bool}. A zero value, null
10701070
pointer value, or null member pointer value is converted to \tcode{false}; any
1071-
other value is converted to \tcode{true}. For
1072-
direct-initialization\iref{dcl.init}, a prvalue of type
1073-
\tcode{std::nullptr_t} can be converted to a prvalue of type
1074-
\tcode{bool}; the resulting value is \tcode{false}.
1071+
other value is converted to \tcode{true}.
10751072

10761073
\indextext{conversion!standard|)}
10771074

source/overloading.tex

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2747,8 +2747,7 @@
27472747

27482748
\begin{itemize}
27492749
\item
2750-
A conversion that does not convert a pointer,
2751-
a pointer to member, or \tcode{std::nullptr_t}
2750+
A conversion that does not convert a pointer or a pointer to member
27522751
to
27532752
\tcode{bool}
27542753
is better than one that does.

0 commit comments

Comments
 (0)