This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of EWG status.

### 2432. `initializer_list` assignability

Section: 17.10 [support.initlist] Status: EWG Submitter: David Krauss Opened: 2014-09-30 Last modified: 2015-05-22

Priority: 2

View other active issues in [support.initlist].

View all other issues in [support.initlist].

View all issues with EWG status.

Discussion:

`std::initializer_list::operator=` 17.10 [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 16.3 [description] says, but it probably doesn't matter.

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

Proposed resolution:

1. Edit 17.10 [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;
   >         […]
   >       };
   >       […]
   >     }