[Patch/c++] Fix PR 14688 (conflicting type attributes of virtual methods)

Danny Smith dannysmith@clear.net.nz
Tue Sep 18 22:50:00 GMT 2007


PR c++/14688 is due to failure to check if the type attributes of
virtual
methods in derived class conflict with type attributes in base class. As
the test case in the PR demonstate this can result in unexpected
behaviour when the function type attributes specify a calling
convention. 

Fixed by:

1) Checking METHOD_TYPEs as well as FUNCTION_TYPEs in the i386 version
of targetm.comp_type_attributes. Note I have _not_ made the
corresponding change to bfin_comp_type_attributes or
arm_comp_type_attributes so these targets are not affected. I suspect
that they too should check METHOD_TYPEs.

2) Using targetm.comp_type_attributes in cp/search.c
(check_final_overrider) to test for conflicts.

Bootstrapped and tested on i386-pc-mingw32 

OK for trunk?

:ADDPATCH c++:

ChangeLog
2007-09-18  Danny Smith  <dannysmith@user.sourceforge.net>
	PR c++/14688
	* config/i386/i386.c (ix86_comp_type_attributes): Check
	METHOD_TYPE too.

cp/ChangeLog

	PR c++/14688
        * search.c (check_final_overrider): Fail if
	targetm.comp_type_attributes returns 0.

testsuite/ChangeLog

	PR c++/14688
	* g++.dg/inherit/override_attribs.C: New file.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr14688.diff
Type: application/octet-stream
Size: 2286 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20070918/49765dbc/attachment.obj>


More information about the Gcc-patches mailing list