aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/decl.c
diff options
context:
space:
mode:
authorNicola Pero <nicola.pero@meta-innovation.com>2010-11-27 18:17:14 +0000
committerNicola Pero <nicola@gcc.gnu.org>2010-11-27 18:17:14 +0000
commit9d780cb2fbf609e85c00d037a570f53a3ea4773c (patch)
tree19a4fcdc53c7001b27ccef3f130c8f27436a9ba7 /gcc/cp/decl.c
parent559d60552c6006428fcdedac16209731ad7c917e (diff)
downloadgcc-9d780cb2fbf609e85c00d037a570f53a3ea4773c.zip
gcc-9d780cb2fbf609e85c00d037a570f53a3ea4773c.tar.gz
gcc-9d780cb2fbf609e85c00d037a570f53a3ea4773c.tar.bz2
In gcc/cp/: 2010-11-27 Nicola Pero <nicola.pero@meta-innovation.com>
In gcc/cp/: 2010-11-27 Nicola Pero <nicola.pero@meta-innovation.com> PR objc++/46222 * decl.c (grokdeclarator): Replaced an assert (for a case that can never happen in C++, but could happen in ObjC++ for invalid code) with a check that prints an error message and returns error_mark_node. In gcc/testsuite/: 2010-11-27 Nicola Pero <nicola.pero@meta-innovation.com> PR objc++/46222 * obj-c++.dg/property/at-property-2.mm: Uncommented testcase. From-SVN: r167202
Diffstat (limited to 'gcc/cp/decl.c')
-rw-r--r--gcc/cp/decl.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 787608c..c494e1c 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -9531,7 +9531,21 @@ grokdeclarator (const cp_declarator *declarator,
if (friendp == 0)
{
- gcc_assert (ctype);
+ /* This should never happen in pure C++ (the check
+ could be an assert). It could happen in
+ Objective-C++ if someone writes invalid code that
+ uses a function declaration for an instance
+ variable or property (instance variables and
+ properties are parsed as FIELD_DECLs, but they are
+ part of an Objective-C class, not a C++ class).
+ That code is invalid and is caught by this
+ check. */
+ if (!ctype)
+ {
+ error ("declaration of function %qD in invalid context",
+ unqualified_id);
+ return error_mark_node;
+ }
/* ``A union may [ ... ] not [ have ] virtual functions.''
ARM 9.5 */