Topic: Can a type be defined in a catch argument?


Author: dcc@hpax.cup.hp.com (Don Cameron)
Date: 1996/03/25
Raw View
Is the following legal?

   try {
 // ...
   }
   catch ( class X { // ... } y )
   {
 // ...
   }

This would seem to be nonsensical (how can a thrown object's type
match X according to the throw/catch matching rules?), but I can't find
where it's disallowed by the Jan. 96 WP, either in the grammar or in
Section 15.

15.4.6 on exception specifications states

   Types shall not be defined in exception-specifications.

Isn't a similar restriction needed for exception-declarations (i.e.,
catch arguments)?

-----------------------------------------------------------------------------
Don Cameron            dcc@cup.hp.com | you are in a maze of twisty little
HP Calif. Language Lab Cupertino, CA  | assembly instructions, all alike
-----------------------------------------------------------------------------
---
[ comp.std.c++ is moderated.  To submit articles: Try just posting with your
                newsreader.  If that fails, use mailto:std-c++@ncar.ucar.edu
  comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
  Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
  Comments? mailto:std-c++-request@ncar.ucar.edu
]