This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: Static variables in template functions
On Tue, 19 Apr 2005 16:48:41 -0700, Mark Mitchell <mark@codesourcery.com> wrote:
> I'm proposing that on platforms without weak symbols we perform all
> initializations of function-scoped static data dynamically, thereby
> implementing the semantics required by the standard, even though it is
> sub-optimal in terms of performance.
>
> If I understand correctly, your position is that we should instead,
> continue to have the current behavior (generate incorrect code, with a
> warning), except that we should avoid issuing the warning in the case of a
> const, non-addressed variable, as in that case the code we generate is in
> fact correct.
>
> Do I have it right?
That sounds about right. A compromise which I would support would be to
always initialize non-const variables dynamically, but const variables
statically, and warn if the const variables are addressable.
Jason