<div dir="ltr">Hi all,<div><br></div><div>I recently noticed that clang and gcc print __PRETTY_FUNCTION__ in different formats, e.g.:</div><div><br></div><div><div>template <typename T> struct X</div><div>{</div><div>  X() { std::cout << __PRETTY_FUNCTION__ << '\n';}</div><div>};</div><div>X<void> x;<br></div><div><br></div><div>In gcc:</div><div>X<T>::X() [with T = void]<br></div><div><br></div><div>In clang:</div><div>X<void>::X() [T = void]<br></div><div><br></div><div>I only found a discussion about it from 2011, that added the template args to the output:</div><div><br></div><div><a href="http://clang-developers.42468.n3.nabble.com/clang-and-gcc-implement-PRETTY-FUNCTION-differently-td3550386.html">http://clang-developers.42468.n3.nabble.com/clang-and-gcc-implement-PRETTY-FUNCTION-differently-td3550386.html</a><br></div><div><br></div><div>I also created a patch that implements the gcc format, but broke all the diagnostic tests, because it needs the instantiated name to report  warning/errors (which is correct in my opinion). <br></div><div><br></div><div>One solution would be adding a new attribute in PrintingPolicy to handle the case where we want to print these predefined expressions, then enabling it in PredefinedExpr::ComputeName.</div><div><br></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">Is there any interest in the community to match gcc's output? There are some valid points in the previous thread.</span><br></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><br></span></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">Thank you,</span></div><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div><br></div><div>Mikhail Ramalho.</div></div></div>
</div></div>