This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Mangling of namespace-scoped templates


> This shouldn't be necessary.  The FDIS says
> 
>   14.7.1 - Implicit instantiation [temp.inst]
> 
>   -10- Implicitly instantiated class and function template specializations
>   are placed in the namespace where the template is defined. Implicitly
>   instantiated specializations for members of a class template are placed in
>   the namespace where the enclosing class template is defined. Implicitly
>   instantiated member templates are placed in the namespace where the
>   enclosing class or class template is defined.
> 
> the bug is that the context of the instantiation isn't being set.

Maybe I'm missing the point, but: This doesn't say 'namespace of
instantiation' anywhere, it says 'namespace of definition' always.

So for mangling, we definitely need the namespace of the template
declaration, right?

The other question is what the DECL_CONTEXT of a template
instantiation should be. I remember changing this back and forth, and
eventually set them always to the global context. This is not a bug:
Unlike normal declarations, the DECL_IDENTIFIER already uniquely
identifies the template and all its parameters.

I believe this will work. Another option would be to always set the
DECL_CONTEXT of the instantiation to the context of the definition.
This might work as well, but is a significant change, IMO. Please note
that current_decl_namespace uses the same approach.

What do you think?

Martin


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]