<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Sep 6, 2017, at 5:50 PM, Richard Smith <<a href="mailto:richard@metafoo.co.uk" class="">richard@metafoo.co.uk</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote">On 6 September 2017 at 14:16, Tom Honermann via cfe-dev <span dir="ltr" class=""><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank" class="">cfe-dev@lists.llvm.org</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Clang appears to be generating ill-formed mangled names for local types<br class="">
declared in Apple Block expressions used as non-static data member<br class="">
initializers:<br class="">
<br class="">
$ cat t.cpp<br class="">
template<typename T> void tf(T) {}<br class="">
struct S {<br class="">
void(^bp)() = ^{<br class="">
enum E {} e;<br class="">
tf(e);<br class="">
};<br class="">
};<br class="">
auto x = S{}.bp;<br class="">
<br class="">
$ clang++ --version<br class="">
clang version 4.0.0 (tags/RELEASE_400/final)<br class="">
Target: x86_64-unknown-linux-gnu<br class="">
Thread model: posix<br class="">
...<br class="">
<br class="">
$ clang++ -c -std=c++11 -fblocks t.cpp<br class="">
$ nm t.o<br class="">
...<br class="">
0000000000000000 W _Z2tfIZ1S2bpMUb0_E1EEvT_<br class="">
...<br class="">
<br class="">
The mangled name generated for the function template specialization<br class="">
instantiated for the local enum type 'E' uses a <pointer-to-member-type><br class="">
production [1] (as signified by 'M'),</blockquote><div class=""><br class=""></div><div class="">I believe you're mistaken. This is not a context in which a <type> production can appear. That's a <data-member-prefix>:</div><div class=""><br class=""></div><div class=""><a href="http://itanium-cxx-abi.github.io/cxx-abi/abi.html#mangle.data-member-prefix" class="">http://itanium-cxx-abi.github.io/cxx-abi/abi.html#mangle.data-member-prefix</a><br class=""></div><div class=""><br class=""></div><div class="">... which specifies a context of the default member initializer of S::bp.</div><div class=""><br class=""></div><div class="">The following construct (the Ub0_) is a vendor extension for naming a block closure.</div><div class=""><br class=""></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> but only one of the two required<br class="">
dependent productions is present (<class type> via 'Ub0_', but not<br class="">
<member type>).<br class="">
<br class="">
If someone can confirm that this is not intentional (it could be since<br class="">
Apple Blocks aren't governed by the Itanium ABI), I'll file a new BZ for<br class="">
this.<br class=""></blockquote><div class=""><br class=""></div><div class="">This behavior looks correct to me, except that I'm surprised that this block is numbered as Ub0_ instead of Ub_. Looks like we have an off-by-one error here, introduced in r214699 while fixing a different off-by-one error.</div><div class=""><br class=""></div><div class="">John: should we restore the pre-r214699 ABI, or would you prefer that we just accept the new mangling as our ABI now?</div></div></div></div></div></blockquote><div><br class=""></div>Nothing about blocks ever has identity across translation units, so there's no harm in fixing the bug and restoring the original ABI to start counting at b_.</div><div><br class=""></div><div>John.</div><div><br class=""></div><div><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote"><div class=""> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Additionally, for unnamed local types, discriminators are not added to<br class="">
disambiguate such types. Bug 34511 [2] has been filed for that issue.<br class="">
<br class="">
Tom.<br class="">
<br class="">
[1]:<br class="">
<a href="http://itanium-cxx-abi.github.io/cxx-abi/abi.html#mangle.pointer-to-member-type" rel="noreferrer" target="_blank" class="">http://itanium-cxx-abi.github.<wbr class="">io/cxx-abi/abi.html#mangle.<wbr class="">pointer-to-member-type</a><br class="">
[2]: <a href="https://bugs.llvm.org/show_bug.cgi?id=34511" rel="noreferrer" target="_blank" class="">https://bugs.llvm.org/show_<wbr class="">bug.cgi?id=34511</a><br class="">
______________________________<wbr class="">_________________<br class="">
cfe-dev mailing list<br class="">
<a href="mailto:cfe-dev@lists.llvm.org" class="">cfe-dev@lists.llvm.org</a><br class="">
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank" class="">http://lists.llvm.org/cgi-bin/<wbr class="">mailman/listinfo/cfe-dev</a><br class="">
</blockquote></div><br class=""></div></div>
</div></blockquote></div><br class=""></body></html>