Commit 7801b86a by Simon Martin Committed by Simon Martin

re PR c++/43081 (ICE with invalid in-class initializer)

gcc/cp/

2010-03-20  Simon Martin  <simartin@users.sourceforge.net>

	PR c++/43081:
	* decl2.c (grokfield): Handle invalid initializers for member
	functions.

gcc/testsuite/

2010-03-20  Simon Martin  <simartin@users.sourceforge.net>
	    Michael Matz  <matz@suse.de>

	PR c++/43081
	* g++.dg/parse/crash56.C: New test.

Co-Authored-By: Michael Matz <matz@suse.de>

From-SVN: r157597
parent 941ce52b
2010-03-20 Simon Martin <simartin@users.sourceforge.net>
PR c++/43081:
* decl2.c (grokfield): Handle invalid initializers for member
functions.
2010-03-20 Dodji Seketeli <dodji@redhat.com>
PR c++/43375
......
......@@ -908,8 +908,13 @@ grokfield (const cp_declarator *declarator,
}
else if (TREE_CODE (TREE_TYPE (value)) == METHOD_TYPE)
{
gcc_assert (error_operand_p (init) || integer_zerop (init));
DECL_PURE_VIRTUAL_P (value) = 1;
if (integer_zerop (init))
DECL_PURE_VIRTUAL_P (value) = 1;
else if (error_operand_p (init))
; /* An error has already been reported. */
else
error ("invalid initializer for member function %qD",
value);
}
else
{
......
2010-03-20 Simon Martin <simartin@users.sourceforge.net>
Michael Matz <matz@suse.de>
PR c++/43081
* g++.dg/parse/crash56.C: New test.
2010-03-20 Paul Thomas <pault@gcc.gnu.org>
PR fortran/43450
......
/* PR c++/43081 */
/* { dg-do "compile" } */
/* { dg-options "-std=c++0x" } */
struct A
{
typedef void (F)();
F f = []{}; /* { dg-error "invalid initializer" } */
};
struct B
{
typedef void (F)();
F f = 1; /* { dg-error "invalid initializer" } */
virtual F f2 = 2; /* { dg-error "invalid initializer" } */
F f3 = 3; /* { dg-error "invalid initializer" } */
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment