aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/decl2.c
diff options
context:
space:
mode:
authorVolker Reichelt <reichelt@gcc.gnu.org>2005-08-11 22:46:29 +0000
committerVolker Reichelt <reichelt@gcc.gnu.org>2005-08-11 22:46:29 +0000
commitea7ce50bf7fcd34d903b9dd1b238f099c9cc0534 (patch)
tree28c40802942a7d9fc02787e809812320186261a5 /gcc/cp/decl2.c
parent86bd8ebf5dec81d0a84b72a289db5af36f7d866d (diff)
downloadgcc-ea7ce50bf7fcd34d903b9dd1b238f099c9cc0534.zip
gcc-ea7ce50bf7fcd34d903b9dd1b238f099c9cc0534.tar.gz
gcc-ea7ce50bf7fcd34d903b9dd1b238f099c9cc0534.tar.bz2
re PR c++/23266 (ICE on pure specifier for static method)
PR c++/23266 * decl2.c (grokfield): Check that method is not static before marking it as pure. PR c++/23266 * g++.dg/inherit/pure1.C: New test. * ChangeLog: Fix typos. From-SVN: r103006
Diffstat (limited to 'gcc/cp/decl2.c')
-rw-r--r--gcc/cp/decl2.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index e7db552..b08bac8 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -896,9 +896,17 @@ grokfield (const cp_declarator *declarator,
{
/* Initializers for functions are rejected early in the parser.
If we get here, it must be a pure specifier for a method. */
- gcc_assert (TREE_CODE (TREE_TYPE (value)) == METHOD_TYPE);
- gcc_assert (error_operand_p (init) || integer_zerop (init));
- DECL_PURE_VIRTUAL_P (value) = 1;
+ if (TREE_CODE (TREE_TYPE (value)) == METHOD_TYPE)
+ {
+ gcc_assert (error_operand_p (init) || integer_zerop (init));
+ DECL_PURE_VIRTUAL_P (value) = 1;
+ }
+ else
+ {
+ gcc_assert (TREE_CODE (TREE_TYPE (value)) == FUNCTION_TYPE);
+ error ("initializer specified for static member function %qD",
+ value);
+ }
}
else if (pedantic && TREE_CODE (value) != VAR_DECL)
/* Already complained in grokdeclarator. */