[cfe-dev] clang and gcc implement __PRETTY_FUNCTION__ differently

Eli Friedman eli.friedman at gmail.com
Wed Mar 14 15:31:07 PDT 2012


On Wed, Mar 14, 2012 at 3:09 PM, Nikola Smiljanic <popizdeh at gmail.com> wrote:
> I tried what you suggested, and almost got it to work :) except in one case:
>
> template <typename T>
> class Class
> {
> public:
>   template <typename U>
>   void member(T t, U u){}
> };
>
> Class<int> c;
> c.member(0, 0.0f);
>
> This is a function template specialization. I
> call FD->getPrimaryTemplate()->getTemplatedDecl(); But the first parameter
> is still a SubstTemplateTypeParmType, so it prints int instead of T. What am
> I doing wrong, I would expect this to be a member specialization kind?

There are multiple templates here, so you need to look through both of
them.  "FD->getPrimaryTemplate()->getTemplatedDecl()" only gets you
the function template which is a member of Class<int>.

-Eli




More information about the cfe-dev mailing list