<div dir="ltr"><div><div><div>what i think could be the possible error is that while evaluating our expression X a = {Y()}; , in the function InitializationSequence we call the function which in turn calls TryListInitialization function, which evaluates all the possible contructors for overloading, but does not check for conversion functions. so TryListInitialization reports failure in finding any candidate function for overloading.<br>
<br></div>whereas in the code flow for X aa = Y(); the the function TryUserDefinedConversion is called from InitializationSequence which is able to properly get the candidate function.<br><br></div>So maybe we should call TryUserDefinedConversion from within the TryListInitialization function passing Y() of the initlist in the cases when normal overloading is failing.<br>
<br></div>Please suggest.<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Sep 26, 2013 at 3:16 AM, Eli Friedman <span dir="ltr"><<a href="mailto:eli.friedman@gmail.com" target="_blank">eli.friedman@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>I'm not really an overload resolution expert, so I could be wrong. Anyway, please file a bug report (<a href="http://llvm.org/bugs/" target="_blank">http://llvm.org/bugs/</a>), and our overload resolution experts will take a look. :) </div>
<span class="HOEnZb"><font color="#888888">
<div><br></div><div>-Eli</div></font></span><div><div class="h5"><div><br></div>On Wed, Sep 25, 2013 at 6:34 AM, Mayur Pandey <span dir="ltr"><<a href="mailto:mayurthebond@gmail.com" target="_blank">mayurthebond@gmail.com</a>></span> wrote:<br>
<div class="gmail_extra">
<div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Actually it should have not thrown error at all. it works fine with gcc. And the part of code which you mentioned is not getting hit at all. Maybe some difference in parsing is there.<br>
</div><div class="gmail_extra"><div><div>
<br><br><div class="gmail_quote">On Wed, Sep 25, 2013 at 5:29 AM, Eli Friedman <span dir="ltr"><<a href="mailto:eli.friedman@gmail.com" target="_blank">eli.friedman@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><div><div>On Mon, Sep 23, 2013 at 11:43 PM, Mayur Pandey <span dir="ltr"><<a href="mailto:mayurthebond@gmail.com" target="_blank">mayurthebond@gmail.com</a>></span> wrote:<br></div></div><div class="gmail_extra">
<div class="gmail_quote"><div><div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div><div>for the following code:<br><br>struct X<br>
{<br> X();<br>};<br><br>struct Y<br>{<br> operator X() const;<br>};<br><br>X a = { Y() }; // reports error: no matching constructor for initialization of 'X'<br>
X aa = Y(); // works fine<br><br><br></div>clang when compiled with std=c++11 gives compilation errors as:<br><br><br>testfile.C:11:3: error: no matching constructor for initialization of 'X'<br>X a = { Y() }; // reports error: no matching constructor for initialization of 'X'<br>
^ ~~~~~~~<br>testfile.C:1:8: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'Y' to 'const X &' for 1st<br> argument<br>struct X<br> ^<br>
testfile.C:1:8: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'Y' to 'X &&' for 1st<br> argument<br>struct X<br> ^<br>testfile.C:3:3: note: candidate constructor not viable: requires 0 arguments, but 1 was provided<br>
X();<br> ^<br>1 error generated.<span><font color="#888888"><br></font></span></div><div><br></div></div></blockquote><br></div></div>See C++11 [over.best.ics]p4. We could probably improve the diagnostic here, though; please file a bug.</div>
<span><font color="#888888">
<div class="gmail_quote"><br></div><div class="gmail_quote">-Eli</div></font></span></div></div>
</blockquote></div><br><br clear="all"><br></div></div><div>-- <br><div>Thanx & Regards <br></div>
<div><b>Mayur Pandey </b><br></div>
</div><div>Senior Software Engineer</div>
<div>Samsung India Software Operations<br>Bangalore<br><a href="tel:%2B91-9742959541" value="+919742959541" target="_blank">+91-9742959541</a><br><font color="#3333ff"></font><font color="#3333ff"> <br></font></div>
<div> </div>
<div> </div>
</div>
</blockquote></div><br></div></div></div></div>
</blockquote></div><br><br clear="all"><br>-- <br><div>Thanx & Regards <br></div>
<div><b>Mayur Pandey </b><br></div>
<div style="color:rgb(0,0,0)">Senior Software Engineer</div>
<div>Samsung India Software Operations<br>Bangalore<br>+91-9742959541<br><font color="#3333ff"></font><font color="#3333ff"> <br></font></div>
<div> </div>
<div> </div>
</div>