From patchwork Tue Oct 5 19:58:52 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Fix for PR objc++/23614 Date: Tue, 05 Oct 2010 09:58:52 -0000 From: Nicola Pero X-Patchwork-Id: 66855 Message-Id: <1286308732.39247124@192.168.2.231> To: "gcc-patches@gnu.org" 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 + 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 + 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 @@ -38,7 +37,7 @@ MyWidget gWidget; @implementation Container + (MyWidget *)elementForView:(Foo *)view { - MyWidget *widget = nil; + MyWidget *widget; if ([view conformsTo:@protocol(MyProto)]) { widget = [(Foo *)view widget]; }