PR3042

Mark Mitchell mark@codesourcery.com
Sun Jun 10 02:05:00 GMT 2001


>>>>> "David" == David Edelsohn <dje@watson.ibm.com> writes:

    David> 	The reason that I see this and the previous implicit
    David> template instantiation COMDAT issues as different is that
    David> "static" is a well-defined C and C++ keyword with

I think you're misunderstanding what it means in C++.  In C++, in this
context, it means nothing about linkage.  It means that there is one
instance of the variable, shared across all objects in the class, as
opposed to an ordinary data member, which is just a field.

In C++, in this context, `static' does *not* mean "only visible in
this translation unit".

    David> 	Implicit instantiation is an implementation issue, not
    David> a language issue. 

I don't know what this means.  "Implicit instantiation" is a term
defined in the language standard.  Different compilers handle it in
different ways, but g++ is quite simply broken on platforms without
weak symbols -- there are programs that the standard says should work
that do not.  You have to add explicit instantiations that the
standard says you should not have to.

    David> 	The previous COMDAT change basically was a statement
    David> that the GNU C++ implementation on AIX (and similar
    David> platforms, like Tru64?) does not support
    David> -fimplicit-templates on that platform.  That is a quality
    David> of implementation issue, not a correctness issue.

No, see above.  Failure to support implicit instantiation *is* a
correctness issue.

    David> 	Your proposed change to COMDAT modifying "static" is a

Again, I'm not proposing modifying COMDAT -- we're talking about
COMMON.

    David> correctness issue, IMHO.  It may make things "consistent"
    David> (for some definition of consitency), but it breaks the
    David> language implementation on that platform.

No -- it only makes current brokeness more obvious.  More programs
will fail than did before -- but it will be easier for users to
understand how to fix them.

    David> 	I do not know the details of the ISO C++ Language
    David> specification.  All compiler implementation seem to have
    David> some leeway on template instantiation, but do not seem to
    David> have any leeway on static class members.  

These are static class members in template instantiations.  There's an
interplay.

    David> whether your proposed change makes things "consistent", I
    David> do not think that we have the latitude to break the
    David> semantic meaning of the language on some targets.

Agreed -- but that's not what we're talking about.  It's already
rather broken.

--
Mark Mitchell                   mark@codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com



More information about the Libstdc++ mailing list