(libc++) Implicit type converstion, value initialization and initializer lists

I picked up an assert in a libc++ test with MSVC and am unsure whether actually MSVC is actually performing as per the standard in this case.

The test is:


The code in question is:

typedef int T;
typedef std::forward_list C;
typedef C::iterator I;
C c;
I i = c.insert_after(c.cbefore_begin(), {});
assert(i == c.before_begin());

The intention is that calling insert_after with an empty initializer list will insert nothing, hence the assert criterion. However, empty initializers for int should be subject to value initialization, i.e. {} should be interpreted as int i{};. So should this call not be equivalent to:

I i = c.insert_after(c.cbefore_begin(), 0);?

MSVC compiles the code in this way, i.e.

iterator insert_after(const_iterator __p, value_type&& __v){…}

is called instead of

iterator insert_after(const_iterator __p, initializer_list<value_type> __il){…}

hence the list grows by one in size.

My guess would be that MSVC is doing the wrong thing, as this is usually the case. However, I can’t be certain in this case so appeal to the experts on this. If MSVC is correct then this actually points to a clang bug not a libc++ one.