[PATCH] Fix PR c++/43081: ICE with invalid in-class initializer

Simon Martin simartin@users.sourceforge.net
Fri Mar 19 18:21:00 GMT 2010


Hello,

The following invalid snippet triggers ICEs with the mainline (the
"struct B" part is a regression against 3.4)

=== cut here ===
struct A
{
           typedef void (F)();
           F f = []{};
};
struct B
{
           typedef void (F)();
           F f = 1;
};
=== cut here ===

The problem is that 'grokfield' asserts that initializers for member
functions are either '0' or 'error_mark_node', while we have something
else here. The attached patch fixes this by removing the 'assert' and
emitting an error if we have something other than '0' or
'error_mark_node'.

I have successfully regtested it on 86_64-apple-darwin-9. Is it OK
for trunk?

Best regards,
             Simon

:ADDPATCH c++:








-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: CL_43081
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20100319/5e9837cd/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: pr43081.patch
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20100319/5e9837cd/attachment-0001.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: CL_43081_testsuite
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20100319/5e9837cd/attachment-0002.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: crash56.C
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20100319/5e9837cd/attachment-0003.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: lambda-error.C
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20100319/5e9837cd/attachment-0004.ksh>


More information about the Gcc-patches mailing list