This is the mail archive of the gcc@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++: Tag transparent binding contour


On 19 Sep 2003 11:49:17 -0700, Mark Mitchell <mark@codesourcery.com> wrote:

> On Fri, 2003-09-19 at 11:23, Jason Merrill wrote:
>> On Fri, 19 Sep 2003 01:47:24 -0700, "Mark Mitchell" <mark@codesourcery.com> wrote:
>> 
>> >> Thanks. Do you have a suggestion for dealing with the (pseudo-)scope
>> > created
>> >> for EH purposes?  If I understand Jason correctly, we need a region to
>> >> contain only EH stuff and no names.  sk_cleanup (following Jason's
>> >> previous adice) seems to work -- but I agree with you that it would be
>> >> nicer if we didn't need it.
>> >
>> > We've lived with this wart for a long time; we can live with it a while
>> > longer.  So, I don't object to sk_cleanup; it's no worse than what we have
>> > now.
>> >
>> > I'm not sure exactly what the reason for the EH is.   I think I used to
>> > understand this, but I do not understand any more.  Perhaps Jason can
>> > explain it.
>> 
>> It isn't EH-specific, actually; it's necessary for cleanups in general.
>> Running cleanups is handled by the binding contour code in stmt.c.
>> 
>>   struct A { ~A(); };
>> 
>>   void f ()
>>   {
>>     A a1;
>>    label:
>>     A a2;
>> 
>>     ...
>>   }
>
> Can you go into more detail?  How does the label effect anything about
> cleanups?

A "goto label" from within the scope of a2 must destroy a2 but not a1.

The scope of a2 is nested within the scope of a1.  Usually we can elide
them together and just represent one scope per lexical block, but in this
case we need to represent them separately.

Jason


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