G++ BUG: __PRETTY_FUNCTION__ still not quite right

Nathan Sidwell nathan@acm.org
Wed Dec 1 06:45:00 GMT 1999


Hi,
Here's an xfailing test which shows a problem remaining with
__PRETTY_FUNCTION__ and __FUNCTION__ in template functions.
In a templated function (but not a specialization), a static
declaration of the __PRETTY__FUNCTION__ variable is always
emitted (even if never used). This prevents inlining, 
and bloats the object file :-(

ok to install test?

nathan
-- 
Dr Nathan Sidwell :: Computer Science Department :: Bristol University
Never hand someone a gun unless you are sure where they will point it
nathan@acm.org  http://www.cs.bris.ac.uk/~nathan/  nathan@cs.bris.ac.uk
// Build don't link:
// Special g++ Options: -ansi -pedantic-errors -O2 -Winline

// Copyright (C) 1999 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 1 Dec 1999 <nathan@acm.org>

// __PRETTY_FUNCTION__ and __FUNCTION__ should not be emitted
// when they're not needed. This causes inlining to fail.


template <class T> inline void foo(T)
{ // gets bogus error - warning can't inline - XFAIL *-*-*
  
}

template <> inline void foo (float)
{
  
}

void fn()
{
  foo (0);  // gets bogus error - warning can't inline - XFAIL *-*-*
  foo (0.0f);
}


More information about the Gcc-bugs mailing list