[cfe-dev] clang and gcc implement __PRETTY_FUNCTION__ differently

John McCall rjmccall at apple.com
Mon Mar 19 11:28:54 PDT 2012


On Mar 19, 2012, at 9:21 AM, Nikola Smiljanic wrote:
>> As John noted, if you want to get back to the original source, you'll need to make this a loop. Plus, you'll probably > want to check if it was an explicit specialization and stop iterating at that point, since explicit specializations were > written by the user (rather than instantiated).
> 
> After some poking around I realized that I've seen code like this
> somewhere. This is exactly what  getTemplateInstantiationPattern does,
> it even handles the explicit specialization case that I wasn't aware
> of. But I still can't think of the test case where repeated calls to
> getInstantiatedFromMemberTemplate are needed, please help.

It's a bit contrived, but think deeply nested templates:

template <class T> class A {
  template <class U> class B {
    template <class V> class C {
    };
  };
};

A<char>::B<char>::C<V> will be instantiated from A<char>::B<U>::C<V>, which will be instantiated from A<T>::B<U>::C<V>.

John.



More information about the cfe-dev mailing list