<div dir="ltr">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.<div><br></div><div>The test is:</div><div><br></div><div>std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_init.pass.cpp<br></div><div><br></div><div>The code in question is:</div><div><br></div><div><div><i>        typedef int T;</i></div><div><i>        typedef std::forward_list<T> C;</i></div><div><i>        typedef C::iterator I;</i></div><div><i>        C c;</i></div><div><i>        I i = c.insert_after(c.cbefore_begin(), {});</i></div><div><i>        assert(i == c.before_begin());</i></div><div><br></div></div><div>The intention is that calling insert_after with an empty initializer list will insert nothing, hence the assert criterion.  However, empty initializers for <i>int</i> should be subject to value initialization, i.e. {} should be interpreted as int i{};.  So should this call not be equivalent to:</div><div><br></div><div><i>I i = c.insert_after(c.cbefore_begin(), 0);?</i></div><div><i><br></i></div><div>MSVC compiles the code in this way, i.e. </div><div><br></div><div><div><i>iterator </i><i>insert_after(const_iterator __p, value_type&& __v){...}</i></div></div><div><br></div><div>is called instead of</div><div><br></div><div><i>iterator insert_after(const_iterator __p, initializer_list<value_type> __il){...}</i><br></div><div><i><br></i></div><div>hence the list grows by one in size.</div><div><br></div><div>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.</div><div><br></div><div><br></div></div>