<div dir="ltr">Hi,<br><br>I have a question about C++ name mangling.<div><br></div><div>For the following small program (I failed to get it further minimized), clang++ and g++ generate different symbols for function fin introduced by the last specialization statement.<br><br>clang++: AA<3>::aa BB::fin<3, AA>(AA const&)<br>g++:        AA<3>::aa BB::fin<3, AA>(AA<3> const&)</div><div><br></div><div>If I change the return type of fin to be void, I can see the argument AA<3> can be correctly generated for clang++.<br><br>{code}<br><div>template <int dim>                                                                                                          <br>class AA<br>{<br>    template <class DH> struct Iter;<br><br>    template <template <int> class DH><br>    struct Iter<DH<3> ><br>    {  <br>        typedef DH<3> AA_type;<br>    };  <br><br>    typedef Iter<AA<dim> > IteratorSelector;<br>public:<br>    typedef typename IteratorSelector::AA_type aa;<br>};<br><br>class BB<br>{<br>    template <int dim, template<int> class C><br>    static typename C<dim>::aa fin (const C<dim> &container);<br><br>    template <int dim><br>    static void pp (const AA<dim>& dof)<br>    {  <br>        typename AA<dim>::aa temp = fin (dof);<br>    }  <br>};<br><br>template void BB::pp<3> (const AA<3>&);<br></div><div>{code}</div><div><br></div><div>So anybody know why?</div><div><br></div><div>This problem will cause failure of linking object files generated by clang++ and g++ separately, and potentially introduce run-time bugs.<div><br></div><div>Thanks,</div><div>-Jiangning</div></div></div></div>