Movatterモバイル変換


[0]ホーム

URL:


Issue 210 - WG21 CWG Issues
Title
What is the type matched by an exception handler?
Status
tc1
Section
14.4 [except.handle]
Submitter
Scott Douglass

Created on2000-03-06.00:00:00 last changed48 months ago

Messages

msg6652 (view)
Date: 2000-10-15.00:00:00

Proposed resolution (10/00):

  1. Change 14.2 [except.throw] paragraph 3 from

    Athrow-expression initializes a temporary object, the type ofwhich is determined...

    to

    Athrow-expression initializes a temporary object, called theexception object, the type of which is determined...
  2. Change 14.4 [except.handle] paragraph 3 from

    Ahandler is a match for athrow-expression with anobject of typeE if...

    to

    Ahandler is a match for an exception object of typeEif...
msg331 (view)
Date: 2000-10-15.00:00:00

Proposed resolution (10/00):

  1. Change 14.2 [except.throw] paragraph 3 from

    Athrow-expression initializes a temporary object, the type ofwhich is determined...

    to

    Athrow-expression initializes a temporary object, called theexception object, the type of which is determined...
  2. Change 14.4 [except.handle] paragraph 3 from

    Ahandler is a match for athrow-expression with anobject of typeE if...

    to

    Ahandler is a match for an exception object of typeEif...
msg330 (view)
Date: 2022-11-20.07:54:16

14.4 [except.handle] paragraph 3 says,

Ahandler is a match for athrow-expression with anobject of typeE...

This wording leaves it unclear whether it is the dynamic type of theobject being thrown or the static type of the expression thatdetermines whether a handler is a match for a given exception. Forinstance,

    struct B { B(); virtual ~B(); };    struct D : B { D(); };    void toss(const B* b) { throw *b; }    void f() { const D d; toss(&d); }

In this code, presumably the type to be matched isB and notconst D (14.2 [except.throw]).

Suggested resolution: Replace the cited wording as follows:

Ahandler is a match for athrow-expression whichinitialized a temporary (14.2 [except.throw]) of typeE...
History
DateUserActionArgs
2022-02-18 07:47:23adminsetmessages: +msg6652
2003-04-25 00:00:00adminsetstatus: dr -> tc1
2000-11-18 00:00:00adminsetstatus: ready -> dr
2000-05-21 00:00:00adminsetmessages: +msg331
2000-03-06 00:00:00admincreate

[8]ページ先頭

©2009-2026 Movatter.jp