This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of New status.
propagate_const
conversion functionSection: 6.1.2.6 [fund.ts.v3::propagate_const.const_observers] Status: New Submitter: Giuseppe D'Angelo Opened: 2022-11-04 Last modified: 2022-11-12
Priority: 3
View all issues with New status.
Discussion:
Addresses: fund.ts.v3
This issue has its origin in the discussion of gcc issue 107525.
The current draft of LFTSv3 specifies this conversion function forpropagate_const
in
6.1.2.6 [fund.ts.v3::propagate_const.const_observers]:
constexpr operator const element_type*() const;-7- Returns:
-8- Remarks: This function shall not participate in overload resolution unlessget()
.T
is an object pointer type or has an implicit conversion toconst element_type*
.
The constraint should however specify that const T
(and not T
) needs
to have an implicit conversion to const element_type *
.
const T
cannot do the conversion, then neither const propagate_const<T>
should be able to.
One can design a type X
such as a const X
cannot convert to const element_type *
(for instance, by =delete
ing the corresponding conversion function). If now one asks whether
const propagate_const<X>
is convertible to const element_type *
, the answer is
(surprisingly) "yes".
[Kona 2022-11-12; Set priority to 3]
Proposed resolution:
This wording is relative to N4840.
Modify 6.1.2.6 [fund.ts.v3::propagate_const.const_observers] as indicated:
constexpr operator const element_type*() const;-7- Returns:
-8- Remarks: This function shall not participate in overload resolution unlessget()
.T
is an object pointer type orconst T
has an implicit conversion toconst element_type*
.