]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
In gcc/cp/:
authornicola <nicola@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 27 Nov 2010 18:17:14 +0000 (18:17 +0000)
committernicola <nicola@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 27 Nov 2010 18:17:14 +0000 (18:17 +0000)
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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@167202 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/obj-c++.dg/property/at-property-2.mm

index f5d612d98be22195c61071782b50cdf6c165849f..64224016eea475abc6bddf6217183a858d49bdbb 100644 (file)
@@ -1,3 +1,11 @@
+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.
+
 2010-11-23  Jeffrey Yasskin <jyasskin@google.com>
 
        PR c++/46527
index 787608c891a1f5ebcb607749ef5c0dbf25c88404..c494e1c0b92afb36a6819c8197ceee3aa22f7f63 100644 (file)
@@ -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 */
index 7b6f1306e9b3ba56a436f43c2f6366a89036725a..d7cb0449c0fe13914cac6973cf765fe21bdcaeb2 100644 (file)
@@ -1,3 +1,8 @@
+2010-11-27  Nicola Pero  <nicola.pero@meta-innovation.com>
+
+       PR objc++/46222 
+       * obj-c++.dg/property/at-property-2.mm: Uncommented testcase.
+
 2010-11-27  Nicola Pero  <nicola.pero@meta-innovation.com>
 
        * objc.dg/property/at-property-24.m: New.
index 7966b9a44d0f7b57150618941e370a8216b849dd..d8433dffcd4f4386b51c5175e2e1009773748d49 100644 (file)
@@ -8,7 +8,6 @@
 }
 @property int name __attribute__((deprecated));
 @property int table __attribute__((xxx));       /* { dg-warning ".xxx. attribute directive ignored" } */
-/* FIXME: the test below should not ICE.
-@property void function (void);                  { dg-error "can.t make .function. into a method" } */
+@property void function (void);                 /* { dg-error "declaration of function .function. in invalid context" } */
 @property typedef int j;                        /*  { dg-error "invalid type for property" } */
 @end