<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Feb 4, 2015 at 6:38 PM, John McCall <span dir="ltr"><<a href="mailto:rjmccall@apple.com" target="_blank">rjmccall@apple.com</a>></span> wrote:<br><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"><span class="">> On Jun 5, 2014, at 4:17 PM, Richard Smith <<a href="mailto:richard@metafoo.co.uk">richard@metafoo.co.uk</a>> wrote:<br>
> On Thu, Jun 5, 2014 at 3:11 PM, Alp Toker <<a href="mailto:alp@nuanti.com">alp@nuanti.com</a>> wrote:<br>
> Author: alp<br>
> Date: Thu Jun  5 17:11:20 2014<br>
> New Revision: 210295<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=210295&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=210295&view=rev</a><br>
> Log:<br>
> Remove old proposal notices<br>
><br>
> Let's just go ahead and assume the answer was 'I do'<br>
><br>
> :)<br>
><br>
> You can check what proposals have made it into the ABI here:<br>
><br>
>   <a href="http://mentorembedded.github.io/cxx-abi/abi.html" target="_blank">http://mentorembedded.github.io/cxx-abi/abi.html</a><br>
><br>
> For the ones that aren't in the ABI, having a comment explaining why we're using them and where they come from is useful. None of these three are in the ABI document yet; please back this out for now.<br>
><br>
> John: any chance we could get the ABI document updated with these? (<a href="http://sourcerytools.com/pipermail/cxx-abi-dev/2012-January/000024.html" target="_blank">http://sourcerytools.com/pipermail/cxx-abi-dev/2012-January/000024.html</a>)<br>
<br>
</span>After much delay, added.  We don’t seem to get this right, though, at least not when the destination type isn’t dependent:<br>
<br>
template <class T, class U> T fst(T, U);<br>
struct A {<br>
  int x[3];<br>
};<br>
template <class T> decltype(fst(A{1,2},T())) foo(T t) {}<br>
<br>
int main() {<br>
  foo(1);<br>
}<br>
<br>
We produce:<br>
  _Z3fooIiEDTcl3fstcv1AililLi1ELi2EEEcvT__EEES1_<br>
It should be:<br>
  _Z3fooIiEDTcl3fsttl1ALi1ELi2EcvT__EEES1_<br></blockquote><div><br></div><div>There are quite a few bugs conspiring to give that result :( Our AST is also poorly-suited to this mangling, because the braces are not considered to be part of the functional cast itself; they're part of its subexpression.</div><div><br></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">
If you parenthesize the argument to A:<br>
  template <class T> decltype(fst(A({1,2}),T())) foo(T t) {}<br>
We produce:<br>
  _Z3fooIiEDTcl3fstcv1AcvS0_ililLi1ELi2EEEcvT__EEES1_<br>
It should be:<br>
  _Z3fooIiEDTcl3fstcv1AliLi1ELi2EcvT__EEES1_<br></blockquote><div><br></div><div>Somewhat related, we also get this wrong:</div><div><br></div><div>struct X { X(int); };</div><div>int f(X);</div><div>template<typename T> void f(decltype(f(0), T())) { f(0); }</div><div>void g() { f<int>(0); }</div><div><br></div><div>... because we explicitly mangle the implicit conversion from int to X. I see</div><div><br></div><div>_Z1fIiEvDTcmcl1fLi0EEcvT__EE from EDG<br></div><div>_Z1fIiEvDTcmclL_Z1f1XELi0EEcvT__EE from GCC<br></div><div>_Z1fIiEvDTcmclL_Z1f1XEcvS0_cvS0_Li0EEcvT__EE from Clang</div><div><br></div><div>I think GCC and Clang are right to use the resolved name L_Z1f1XE rather than the unresolved name 1f here, and GCC's mangling is right overall. Do you agree?</div></div></div></div>