<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 6 September 2017 at 14:16, Tom Honermann via cfe-dev <span dir="ltr"><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span> wrote:<br><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>
declared in Apple Block expressions used as non-static data member<br>
initializers:<br>
<br>
$ cat t.cpp<br>
template<typename T> void tf(T) {}<br>
struct S {<br>
void(^bp)() = ^{<br>
enum E {} e;<br>
tf(e);<br>
};<br>
};<br>
auto x = S{}.bp;<br>
<br>
$ clang++ --version<br>
clang version 4.0.0 (tags/RELEASE_400/final)<br>
Target: x86_64-unknown-linux-gnu<br>
Thread model: posix<br>
...<br>
<br>
$ clang++ -c -std=c++11 -fblocks t.cpp<br>
$ nm t.o<br>
...<br>
0000000000000000 W _Z2tfIZ1S2bpMUb0_E1EEvT_<br>
...<br>
<br>
The mangled name generated for the function template specialization<br>
instantiated for the local enum type 'E' uses a <pointer-to-member-type><br>
production [1] (as signified by 'M'),</blockquote><div><br></div><div>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><br></div><div><a href="http://itanium-cxx-abi.github.io/cxx-abi/abi.html#mangle.data-member-prefix">http://itanium-cxx-abi.github.io/cxx-abi/abi.html#mangle.data-member-prefix</a><br></div><div><br></div><div>... which specifies a context of the default member initializer of S::bp.</div><div><br></div><div>The following construct (the Ub0_) is a vendor extension for naming a block closure.</div><div><br></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>
dependent productions is present (<class type> via 'Ub0_', but not<br>
<member type>).<br>
<br>
If someone can confirm that this is not intentional (it could be since<br>
Apple Blocks aren't governed by the Itanium ABI), I'll file a new BZ for<br>
this.<br></blockquote><div><br></div><div>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><br></div><div>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><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>
disambiguate such types. Bug 34511 [2] has been filed for that issue.<br>
<br>
Tom.<br>
<br>
[1]:<br>
<a href="http://itanium-cxx-abi.github.io/cxx-abi/abi.html#mangle.pointer-to-member-type" rel="noreferrer" target="_blank">http://itanium-cxx-abi.github.<wbr>io/cxx-abi/abi.html#mangle.<wbr>pointer-to-member-type</a><br>
[2]: <a href="https://bugs.llvm.org/show_bug.cgi?id=34511" rel="noreferrer" target="_blank">https://bugs.llvm.org/show_<wbr>bug.cgi?id=34511</a><br>
______________________________<wbr>_________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-dev</a><br>
</blockquote></div><br></div></div>