[cfe-dev] Exception Specifications

Sebastian Redl sebastian.redl at getdesigned.at
Sun May 17 02:42:52 PDT 2009


Hi,

I once tried to implement exception specifications, but after talking it
over with Doug, I reverted my changes. The matter is weird, because
while there is some type checking for exception specs, the spec is not
actually part of the canonical type - for example, two function pointers
with different exception specs do not cause different template
instantiations.

There are two ways to implement this. First, make exception specs part
of the canonical type, and handle the cases where it shouldn't be, or
don't make them part of the canonical type, and handle the cases where
there is a difference. The former feels more difficult, more work, and
most importantly, more likely to be wrong. Also, the mistakes you make
in the former would lead to reject-valid or silent miscompilation bugs,
whereas the mistakes you make in the latter would only lead to
accept-invalid bugs.

But where to store the exception spec? Do I store it in the
non-canonical type? I don't think I can store it only in the function
decl, since function pointers can have exception specs, and they don't
have a function decl.

Also, there is the question of efficient processing of the specs. I have
some vague ideas about that involving canonicalization of the spec, but
I was wondering if anyone had any experience with that kind of thing.

Sebastian



More information about the cfe-dev mailing list