From: Volker Reichelt Date: Thu, 11 May 2006 14:41:03 +0000 (+0000) Subject: re PR c++/27547 (ICE on invalid operator=) X-Git-Tag: releases/gcc-4.2.0~2957 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=80cdd94a6c80c6686d39660df2234ad9e9b31ce2;p=thirdparty%2Fgcc.git re PR c++/27547 (ICE on invalid operator=) PR c++/27547 * decl.c (copy_fn_p): Return early on non-member functions. * g++.dg/other/operator1.C: New test. From-SVN: r113696 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index a357204e4a62..898c13fef06a 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2006-05-11 Volker Reichelt + + PR c++/27547 + * decl.c (copy_fn_p): Return early on non-member functions. + 2006-05-08 Volker Reichelt PR c++/27447 diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 057c1fb51691..1b5e41d373c7 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -8818,7 +8818,9 @@ copy_fn_p (tree d) tree arg_type; int result = 1; - gcc_assert (DECL_FUNCTION_MEMBER_P (d)); + if (!DECL_FUNCTION_MEMBER_P (d)) + /* Non-members are invalid. We complained, but kept the declaration. */ + return 0; if (TREE_CODE (d) == TEMPLATE_DECL || (DECL_TEMPLATE_INFO (d) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 418c6718b033..036f0dfc6e3d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2006-05-11 Volker Reichelt + + PR c++/27547 + * g++.dg/other/operator1.C: New test. + 2006-05-11 Richard Guenther PR middle-end/27529 diff --git a/gcc/testsuite/g++.dg/other/operator1.C b/gcc/testsuite/g++.dg/other/operator1.C new file mode 100644 index 000000000000..1760a1c385c9 --- /dev/null +++ b/gcc/testsuite/g++.dg/other/operator1.C @@ -0,0 +1,9 @@ +// PR c++/27547 +// { dg-do compile } + +int operator=(int); // { dg-error "member function" } + +void foo() +{ + operator=(0); +}