This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C++ PATCH] Fix bug 5116, 764
- From: Jason Merrill <jason at redhat dot com>
- To: Mark Mitchell <mark at codesourcery dot com>
- Cc: Nathan Sidwell <nathan at codesourcery dot com>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, "sebor at roguewave dot com" <sebor at roguewave dot com>, "binder at iue dot tuwien dot ac dot at" <binder at iue dot tuwien dot ac dot at>
- Date: Wed, 02 Jan 2002 17:27:24 +0000
- Subject: Re: [C++ PATCH] Fix bug 5116, 764
- References: <107140000.1009992287@gandalf.codesourcery.com>
>>>>> "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