[cfe-dev] clang and gcc implement __PRETTY_FUNCTION__ differently

Kostya Serebryany kcc at google.com
Wed Nov 30 18:34:19 PST 2011


On Wed, Nov 30, 2011 at 6:32 PM, Eli Friedman <eli.friedman at gmail.com>wrote:

> On Wed, Nov 30, 2011 at 6:21 PM, Kostya Serebryany <kcc at google.com> wrote:
> > Hi,
> > Here is one difference between clang and gcc which makes some of our
> > software fail when built with clang.
> > is this something you would consider fixing?
>
> No, we are not going to change the placement of the * in "const char *foo".
>

That's not about '*', but about  "[with T = int]"
I don't think that there is any standard that exactly defines
how __PRETTY_FUNCTION__ behaves, but having
[with T = int]" might be useful.

(But yes, our code that relies on this is ... )

--kcc



> -Eli
>
> > Thanks,
> >
> > --kcc
> >
> > % cat pretty.cc
> > #include <stdio.h>
> > template<class T>
> > const char *foo() {
> >   return __PRETTY_FUNCTION__;
> > }
> > int main() {
> >   printf("%s\n", foo<int>());
> > }
> > % g++ pretty.cc && ./a.out
> > const char* foo() [with T = int]
> > % ~/llvm/build/Release+Asserts/bin/clang++ pretty.cc && ./a.out
> > const char *foo()
> >
> > _______________________________________________
> > cfe-dev mailing list
> > cfe-dev at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20111130/f1b7c64a/attachment.html>


More information about the cfe-dev mailing list