[C++ PATCH] Fix FUNCTION_TYPE hashing problem (PR c++/33506)

Mark Mitchell mark@codesourcery.com
Thu Sep 20 22:29:00 GMT 2007


Jakub Jelinek wrote:

> The attached testcase issues incorrect diagnostics on valid code.
> The problem seems to be caused by type hashing.

> 	PR c++/33506
> 	* decl2.c (cplus_decl_attributes): Restore TYPE_RAISES_EXCEPTIONS
> 	if decl_attributes changed it.

In the long term, I think TYPE_RAISES_EXCEPTION ought to move into
generic code -- there are optimization opportunities available if you
know what exceptions can be thrown by a given function.  But, we're not
doing that kind of change now, so let's not consider that for the moment.

I think you have the right idea with a hook, but I don't think it's in
the right place.  In particular, decl_attributes should be taught not to
corrupt the type in this way.  Instead, I think type_hash_eq should have
a language hook to allow the C++ front end to say that for a
FUNCTION_TYPE the TYPE_RAISES_EXCEPTION matters for equality.

Thanks,

-- 
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713



More information about the Gcc-patches mailing list