Title
[fund.ts.v3] Incorrect constraint on propagate_const conversion function
Status
new
Section
[propagate_const.const_observers]
Submitter
Giuseppe D'Angelo

Created on 2022-11-04.00:00:00 last changed 25 months ago

Messages

Date: 2022-11-12.01:08:30

Proposed resolution:

This wording is relative to N4840.

  1. Modify [propagate_const.const_observers] as indicated:

    constexpr operator const element_type*() const;
    

    -7- Returns: get().

    -8- Remarks: This function shall not participate in overload resolution unless T is an object pointer type or const T has an implicit conversion to const element_type*.

Date: 2022-11-12.01:08:30

[ Kona 2022-11-12; Set priority to 3 ]

Date: 2022-11-04.00:00:00

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 for propagate_const in [propagate_const.const_observers]:

constexpr operator const element_type*() const;

-7- Returns: get().

-8- Remarks: This function shall not participate in overload resolution unless T is an object pointer type or has an implicit conversion to const element_type*.

The constraint should however specify that const T (and not T) needs to have an implicit conversion to const element_type *.

Basically: if 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 =deleteing the corresponding conversion function). If now one asks whether const propagate_const<X> is convertible to const element_type *, the answer is (surprisingly) "yes".

History
Date User Action Args
2022-11-12 01:08:30adminsetmessages: + msg13036
2022-11-05 15:55:24adminsetmessages: + msg12933
2022-11-04 00:00:00admincreate