This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
RE: Fix for PR objc++/23614
- From: "Nicola Pero" <nicola dot pero at meta-innovation dot com>
- To: "gcc-patches at gnu dot org" <gcc-patches at gnu dot org>
- Date: Thu, 7 Oct 2010 19:21:10 +0200 (CEST)
- Subject: RE: Fix for PR objc++/23614
- References: <1286308732.39247124@192.168.2.231>
Ping ... Ok to commit ? :-)
Thanks
-----Original Message-----
From: "Nicola Pero" <nicola.pero@meta-innovation.com>
Sent: Tuesday, 5 October, 2010 21:58
To: "gcc-patches@gnu.org" <gcc-patches@gnu.org>
Subject: Fix for PR objc++/23614
This patch fixes PR objc++/23614.
It was not a bug in the ObjC++ compiler; it was a bug in the test.
The compiler barfed on:
class MyWidget {
public:
int a;
MyWidget(void) { a = 17; }
};
MyWidget *widget = nil;
and I think the compiler is correct in barfing, because widget is a pointer
to a C++ class, and you can't assign 'nil' to it. Note that this assignment
seems irrelevant in the test, which was testing something else.
Thanks
Index: ChangeLog
===================================================================
--- ChangeLog (revision 164997)
+++ ChangeLog (working copy)
@@ -1,5 +1,11 @@
2010-10-05 Nicola Pero <nicola.pero@meta-innovation.com>
+ PR objc++/23614
+ * obj-c++.dg/lookup-2.mm: Do not assign 'nil' to a pointer to a
+ C++ class. Removed XFAIL.
+
+2010-10-05 Nicola Pero <nicola.pero@meta-innovation.com>
+
PR objc++/28050
* obj-c++.dg/syntax-error-10.mm: New.
Index: obj-c++.dg/lookup-2.mm
===================================================================
--- obj-c++.dg/lookup-2.mm (revision 164996)
+++ obj-c++.dg/lookup-2.mm (working copy)
@@ -1,5 +1,4 @@
/* { dg-do run } */
-/* { dg-xfail-if "PR23614" { "*-*-*" } { "*" } { "-fnext-runtime" } } */
/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
#include "../objc-obj-c++-shared/Object1.h"
#include <stdlib.h>
@@ -38,7 +37,7 @@ MyWidget gWidget;
@implementation Container
+ (MyWidget *)elementForView:(Foo *)view
{
- MyWidget *widget = nil;
+ MyWidget *widget = NULL;
if ([view conformsTo:@protocol(MyProto)]) {
widget = [(Foo <MyProto> *)view widget];
}