On Thu, May 30, 2013 at 4:35 PM, Larisse Voufo <span dir="ltr"><<a href="mailto:lvoufo@google.com" target="_blank">lvoufo@google.com</a>></span> wrote:<br><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">Please see attached.</div></blockquote><div><br></div><div>This looks really good.</div><div><br></div><div>Something funny has happened around < >s for templates. I've run the patch through clang-format for you (attached).</div>
<div><br></div><div><br></div><div><div>+                // Fixme: this assumes that both types will be equally</div><div>+                // restrict-qualified.</div></div><div><br></div><div>s/Fixme/FIXME/</div><div><br>
</div><div><div><br></div><div>+                if (ToType.isMoreQualifiedThan(CurToType))</div><div>+                  ToType = CurToType;</div></div><div><br></div><div>The standard doesn't seem very clear on this, but I think you should merge qualifiers here rather than taking the more-qualified type. If we have a conversion to 'const T' and a conversion to 'volatile T', our current choice between them seems to depend on the order in which we see them.</div>
<div><br></div><div><br></div><div><div>+      if (ConvTemplate)</div><div>+        AddTemplateConversionCandidate(ConvTemplate, FoundDecl, ActingContext,</div><div>+                                       From, ToType, CandidateSet);</div>
</div><div><br></div><div>It looks like ViableConversions won't contain any conversion operator templates at this point. However, we should probably be performing overload resolution on the complete set of conversions, not just on the ones we matched earlier, for oddball cases like:</div>
<div><br></div><div>  struct A {</div><div>    operator int() &&;</div><div>    template<typename T> operator T();</div><div>  };</div><div>  void f(A a) {</div><div>    switch (a) {} // should presumably call templated conversion operator to convert to int.</div>
<div>  }</div><div>  struct B {</div><div>    operator bool() &&;</div><div>    operator void*();</div><div>  };</div><div>  void g(B b) {</div><div>    switch (b) {} // should presumably call 'b.operator void*()' then convert result to bool</div>
<div>  }</div><div><br></div><div>The patch could do with more testcases, covering more exotic situations such as the above, and the new error cases.</div><div><br></div><div>Thanks!</div><div>Richard</div></div>