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]
Other format: [Raw text]

Re: [C++ PATCH] Fix bug 5116, 764


>>>>> "Mark" == Mark Mitchell <mark@codesourcery.com> writes:

> The EDG front end contains logic to instantiate a class if you are
> interested in conversion operators for that class.

> That seems like a reasonable thing to do, and that gets you the
> "right" answer for that code.

Yes.

> (In some cases the standard is not well written. I would say that

>   [temp.inst]

>   ... the class template specialization is implicitly instantiated
>   when the specialization is referenced in a context that requires
>   a completely-defined object type or when the completeness of the
>   class type affects the semantics of the program.

> leaves something to be desired, since "affects the semantics of the
> program" is very broad;

If you have ideas for improving the text of the standard, please submit
them.  Probably the simplest way would be to send any proposed wording to
Steve Adamczyk, now that he's maintaining the core issues list.

> instantiating a random class could cause the instantiation of static data
> that has an initializer that does something vital for example.

Yes, but that doesn't matter.  The question is not whether doing the
instantiation will have side effects, but whether the class' completeness
or incompleteness changes how it is used.

In this case, looking up a function in an incomplete type and looking it up
in a complete type are rather different, so the class needs to be
instantiated.

Jason


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