* config.gcc: Remove MASK_JUMP_IN_DELAY from target_cpu_default2.
[official-gcc.git] / gcc / testsuite / obj-c++.dg / cxx-scope-1.mm
blobeb0c377dad9b57811a951f063027ff2baa649ccc
1 /* Handle C++ scoping ('::') operators in ObjC message receivers gracefully.  */
2 /* Author: Ziemowit Laski  <zlaski@apple.com> */
4 /* { dg-do run } */
5 /* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
6 #include "../objc-obj-c++-shared/TestsuiteObject.m"
7 #include <stdlib.h>
9 @class Derived;
11 Derived *inst[3];
13 struct CxxClass {
14   static Derived *get_instance(int);
17 Derived *CxxClass::get_instance(int offs) {
18   return inst[offs];
21 @interface Derived: TestsuiteObject {
22   int value;
24 -(id)initWithValue:(int)val;
25 -(int)derived_meth;
26 @end
28 @implementation Derived
29 -(id)initWithValue:(int)val {
30   [super init];
31   value = val;
32   return self;
34 - (int)derived_meth {
35   return value;
37 @end
39 int main(void) {
40   int r;
41   inst[1] = [[::Derived alloc] initWithValue:7];
42   inst[2] = [[Derived alloc] initWithValue:77];
44   r = [CxxClass::get_instance(2) derived_meth];
45   if (r != 77)
46     abort();
48   r = [CxxClass::get_instance(1) derived_meth];
49   if (r != 7)
50     abort();
52   return 0;