https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80380
Bug ID: 80380 Summary: misleading behavior with designated initializers for std::vector Product: gcc Version: 6.3.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: ethan at atdllc dot com Target Milestone: --- Created attachment 41164 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41164&action=edit short example (not pre-processed) Designated initializers are silently ignored when used in a initializer list for a std::vector. const std::vector<const char *>strings = { [ 0] = "zero", [ 1] = "one", [20] = "twenty", }; This compiles silently, and results in a vector with three elements. Using a std::array does result in an error (error: ‘[0] =’ used in a GNU-style ...), as does initializing an array of char * (sorry, unimplemented: non-trivial designated initializers not supported). If someone really wants a preprocessed .ii file, I can add one tuesday.