The following compiles on MSVC:
#include <initializer_list>
#include <iterator>
int main()
{
int parameters[4]{1, 2, 3, 4};
auto b = std::begin(parameters);
auto e = std::end(parameters);
std::initializer_list<int> il(b,e); // where is the constructor specified in the standard?
}
I used this behavior to answer another question, but while doing some research I found that this constructor is not actually in the standard.
I turned off language extensions with the /Za
and /permissive-
flags, but it still compiles.
Is this a bug in MSVC?
It's actually documented in MSDN:
constexpr initializer_list() noexcept;
initializer_list(const InputIterator First, const InputIterator Last);
but it seems to be a VS-specific feature