[PATCH] Fix PR c++/34059: ICE with invalid base type for class member
Simon Martin
simartin@users.sourceforge.net
Mon Nov 26 23:12:00 GMT 2007
Hi all.
The following invalid snippet triggers an ICE in 4.1, 4.2 and mainline:
=== cut here ===
struct A
{
template<int> void foo();
};
struct B : A {};
struct C : A {};
void bar()
{
B().C::foo<0>();
}
=== cut here ===
The problem is that 'build_class_member_access_expr' computes the scope
of the member being processed from the BINFO_TYPE of its BASELINK_BINFO
(i.e. B) instead of this of its BASELINK_ACCESS_BINFO (i.e. C). As a
result, the expression is accepted, and there is an ICE when converting
the B instance into an instance of C. The attached patch fixes this.
I have successfully regtested it on x86_64-apple-darwin-9 with no new
regression. Is it OK for the mainline? For 4.2?
Best regards,
Simon
:ADDPATCH c++:
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: CL_34059
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20071126/7874f459/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: pr34059.patch
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20071126/7874f459/attachment-0001.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: CL_34059_testsuite
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20071126/7874f459/attachment-0002.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: crash40.C
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20071126/7874f459/attachment-0003.ksh>
More information about the Gcc-patches
mailing list