diff options
author | Volker Reichelt <reichelt@gcc.gnu.org> | 2005-08-11 22:46:29 +0000 |
---|---|---|
committer | Volker Reichelt <reichelt@gcc.gnu.org> | 2005-08-11 22:46:29 +0000 |
commit | ea7ce50bf7fcd34d903b9dd1b238f099c9cc0534 (patch) | |
tree | 28c40802942a7d9fc02787e809812320186261a5 /gcc/cp/decl2.c | |
parent | 86bd8ebf5dec81d0a84b72a289db5af36f7d866d (diff) | |
download | gcc-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.c | 14 |
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. */ |