<div dir="ltr">They're not necessary if you allow `std::string<>` to be instantiated with garbage.<div><br></div><div>We found it distasteful that `std::bitset` poisoned overload sets containing it.<div>For example, MSVC should accept this code but instead emits a hard compile error.</div><div><br></div><div><div style="color:rgb(0,0,0);background-color:rgb(255,255,254)"><div><div><span style="color:rgb(0,0,255)">void</span> f(std::bitset<<span style="color:rgb(9,136,90)">101</span>>);</div><div><span style="color:rgb(0,0,255)">void</span> f(<span style="color:rgb(0,0,255)">void</span>*);</div><div><span style="color:rgb(0,0,255)">void</span>* p;</div><div>f({p}); <span style="color:rgb(0,128,0)">// Blows up.</span></div></div></div></div><br>So despite the standard not requiring `std::bitset` to SFINAE it's constructors,</div><div>it probably means to require that they don't poison overload resolution by blowing up.</div><div><br></div><div>/Eric</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Oct 9, 2019 at 10:08 AM Casey Carter via libcxx-dev <<a href="mailto:libcxx-dev@lists.llvm.org">libcxx-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">The subject test includes this function:<div><br></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><div style="font-family:Consolas,"Courier New",monospace;font-size:14px;line-height:19px;white-space:pre-wrap"><div><font color="#000000" style="background-color:rgb(255,255,255)">void test_for_non_eager_instantiation() {</font></div></div></div><div><div style="font-family:Consolas,"Courier New",monospace;font-size:14px;line-height:19px;white-space:pre-wrap"><div><font color="#000000" style="background-color:rgb(255,255,255)">    // Ensure we don't accidentally instantiate `std::basic_string<Nonsense>`</font></div></div></div><div><div style="font-family:Consolas,"Courier New",monospace;font-size:14px;line-height:19px;white-space:pre-wrap"><div><font color="#000000" style="background-color:rgb(255,255,255)">    // since it may not be well formed and can cause an error in the</font></div></div></div><div><div style="font-family:Consolas,"Courier New",monospace;font-size:14px;line-height:19px;white-space:pre-wrap"><div><font color="#000000" style="background-color:rgb(255,255,255)">    // non-immediate context.</font></div></div></div><div><div style="font-family:Consolas,"Courier New",monospace;font-size:14px;line-height:19px;white-space:pre-wrap"><div><font color="#000000" style="background-color:rgb(255,255,255)">    static_assert(!std::is_constructible<std::bitset<3>, Nonsense*>::value, "");</font></div></div></div><div><div style="font-family:Consolas,"Courier New",monospace;font-size:14px;line-height:19px;white-space:pre-wrap"><div><font color="#000000" style="background-color:rgb(255,255,255)">    static_assert(!std::is_constructible<std::bitset<3>, Nonsense*, size_t, Nonsense&, Nonsense&>::value, "");</font></div></div></div><div><div style="font-family:Consolas,"Courier New",monospace;font-size:14px;line-height:19px;white-space:pre-wrap"><div><font color="#000000" style="background-color:rgb(255,255,255)">}</font></div></div></div></blockquote><div><br></div><div>which requires nonstandard behavior. Should these assertions be libc++-specific? (Should someone file an LWG issue to standardize the expected behavior?)</div></div>
_______________________________________________<br>
libcxx-dev mailing list<br>
<a href="mailto:libcxx-dev@lists.llvm.org" target="_blank">libcxx-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/libcxx-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/libcxx-dev</a><br>
</blockquote></div>