Title
initializer_list assignability
Status
nad
Section
[support.initlist]
Submitter
David Krauss

Created on 2014-09-30.00:00:00 last changed 5 months ago

Messages

Date: 2023-11-13.13:14:11

Proposed resolution:

  1. Edit [support.initlist] p1, class template initializer_list synopsis, as indicated:

    namespace std {
      template<class E> class initializer_list {
      public:
        […]
        constexpr initializer_list() noexcept;
      
        initializer_list(const initializer_list&) = default;
        initializer_list(initializer_list&&) = default;
        initializer_list& operator=(const initializer_list&) = delete;
        initializer_list& operator=(initializer_list&&) = delete;
        
        constexpr size_t size() const noexcept;
        […]
      };
      […]
    }
    
Date: 2023-11-13.13:14:11

[ Varna 2023-06-12; EWG discussed the issue again ]

EWG consensus: "Send LWG2432 back to LWG to encourage them to either add a note for their implementer to issue a warning as QoI, or to use the tools (explicit convertible_to operator=) at their disposal to accomplish their goal"

The operator= suggestion refers to:


initializer_list& operator=(convertible_to<initializer_list> auto&& rhs) { /* ... */ }
initializer_list& operator=(initializer_list const&) requires false = default;

Date: 2022-11-30.00:00:00

[ 2022-11-30 LWG telecon. Status changed: Tentatively NAD → NAD. ]

Date: 2022-11-15.00:00:00

[ 2022-11-25; see EWG 1369 ]

Date: 2022-08-15.00:00:00

[ 2022-08-24; Reflector poll ]

Set status to Tentatively NAD after reflector poll in October 2021.

"If somebody wants to revisit it, they'll need to write a paper to demonstrate what the change would break, whether that would be a problem in practice, and convince the evolution groups to make a change. But it's not an LWG issue."

Date: 2015-05-22.19:58:39

[ Lenexa 2015-05-05: Send to EWG as discussed in Telecon ]

Date: 2014-09-30.00:00:00

std::initializer_list::operator= [support.initlist] is horribly broken and it needs deprecation:

std::initializer_list<foo> a = {{1}, {2}, {3}};
a = {{4}, {5}, {6}};
// New sequence is already destroyed.

Assignability of initializer_list isn't explicitly specified, but most implementations supply a default assignment operator. I'm not sure what [description] says, but it probably doesn't matter.

History
Date User Action Args
2023-11-13 13:14:11adminsetmessages: + msg13833
2022-11-30 17:59:24adminsetmessages: + msg13132
2022-11-25 09:41:00adminsetmessages: + msg13111
2022-08-24 18:53:49adminsetmessages: + msg12708
2022-08-24 18:53:49adminsetstatus: ewg -> nad
2015-05-22 19:58:39adminsetmessages: + msg7451
2015-05-22 19:58:39adminsetstatus: new -> ewg
2014-10-07 17:46:59adminsetmessages: + msg7122
2014-09-30 00:00:00admincreate