§[dcl.init.list] 8.5.4/2:
The template
std::initializer_listis not predefined; if the header<initializer_list>is not included prior to a use ofstd::initializer_list— even an implicit use in which the type is not named (7.1.6.4) — the program is ill-formed.
Does that mean this program is ill-formed?
#include <vector>
int main() {
// uses vector::vector(initializer_list<T>, const Allocator&) constructor
std::vector<int> v = {1, 2, 3};
}
std::vectorconstructor usesinitializer_list, so that must be included in<vector>. But unless that dependency is stated somewhere, the formal could be ill-formed. And the reason for that is that the standard library is allowed to do any kinds of magic, including relying on non-standard behavior of the compiler, so that one can't reason that the standard library must be implemented in the same kind of way as one's own code.