testsuite, Objective-C : Add initialize method to root class.

Older versions of the runtime don't like it when the root class
has a missing initialize method.  They try to forward to an non-
existent super class resulting in a crash.

TODO: maybe we can diagnose this.

gcc/testsuite/ChangeLog:

	* objc.dg/ivar-scope-4.m: Add inititialize method to the
	root class.
This commit is contained in:
Iain Sandoe 2020-10-05 11:38:12 +01:00
parent bae828f7bb
commit 40330e7077

View file

@ -18,6 +18,7 @@ int someivar = 1;
int someivar;
}
+ (id) initialize;
+ (id) alloc;
- (id) init;
- (int) getGlobal;
@ -26,6 +27,11 @@ int someivar = 1;
@end
@implementation MyClass
+ (id) initialize
{
return self;
}
+ (id) alloc
{
return class_createInstance (self, 0);