This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: RFC: Lazy __FUNCTION__ etc
On Wed, Mar 21, 2001 at 06:17:49AM +0100, Gabriel Dos Reis wrote:
> "Zack Weinberg" <zackw@stanford.edu> writes:
> | Now
> | __PRETTY_FUNCTION__ is evaluated immediately, so the generic is just
> | called "f1(T)". This is undesired. I do not know why it happened or
> | how to put the semantics back the way they were - I do see some code
> | aimed at evaluating _P_F_ at template specialization time, in pt.c,
> | but I have no idea how we get there...
>
> The proper way to do it is to introduce new functions to do the right
> thing. Currently we're using bits from cp/errors.c but that is
> fragile and wrong. It's fragile because any change to how we display
> function declarations in diagnostics affects __PRETTY_FUNCTION__. It
> is wrong because it is using the wrong semantics.
That's all very well, but the problem is not that __PRETTY_FUNCTION__
is rendered using the diagnostic machinery. It's an issue of *when*
_P_F_ gets rendered: when the template is instantiated, or when it's
first parsed. Before we did it at instantiation time; with my patch
it happens at parse time. I know why - _P_F_ gets turned into a
string the moment it's lexed - but I have no idea what should be done
with it instead.
zw