OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc1/] [gcc/] [testsuite/] [objc.dg/] [lookup-1.m] - Diff between revs 309 and 338

Only display areas with differences | Details | Blame | View Log

Rev 309 Rev 338
/* { dg-do run } */
/* { dg-do run } */
/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
 
 
#include <stdlib.h>
#include <stdlib.h>
#include "../objc-obj-c++-shared/Object1.h"
#include "../objc-obj-c++-shared/Object1.h"
 
 
typedef struct MyWidget {
typedef struct MyWidget {
  int a;
  int a;
} MyWidget;
} MyWidget;
 
 
MyWidget gWidget = { 17 };
MyWidget gWidget = { 17 };
 
 
@protocol MyProto
@protocol MyProto
- (MyWidget *)widget;
- (MyWidget *)widget;
@end
@end
 
 
@interface Foo: Object
@interface Foo: Object
@end
@end
 
 
@interface Bar: Foo <MyProto>
@interface Bar: Foo <MyProto>
@end
@end
 
 
@interface Container: Object
@interface Container: Object
+ (MyWidget *)elementForView:(Foo *)view;
+ (MyWidget *)elementForView:(Foo *)view;
@end
@end
 
 
@implementation Foo
@implementation Foo
@end
@end
 
 
@implementation Bar
@implementation Bar
- (MyWidget *)widget {
- (MyWidget *)widget {
  return &gWidget;
  return &gWidget;
}
}
@end
@end
 
 
@implementation Container
@implementation Container
+ (MyWidget *)elementForView:(Foo *)view
+ (MyWidget *)elementForView:(Foo *)view
{
{
  MyWidget *widget = (MyWidget *) nil;
  MyWidget *widget = (MyWidget *) nil;
  if ([view conformsTo:@protocol(MyProto)]) {
  if ([view conformsTo:@protocol(MyProto)]) {
    widget = [(Foo <MyProto> *)view widget];
    widget = [(Foo <MyProto> *)view widget];
  }
  }
  return widget;
  return widget;
}
}
@end
@end
 
 
int main(void) {
int main(void) {
  id view = [Bar new];
  id view = [Bar new];
  MyWidget *w = [Container elementForView: view];
  MyWidget *w = [Container elementForView: view];
 
 
  if (!w || w->a != 17)
  if (!w || w->a != 17)
    abort ();
    abort ();
 
 
  return 0;
  return 0;
}
}
 
 
#include "../objc-obj-c++-shared/Object1-implementation.h"
#include "../objc-obj-c++-shared/Object1-implementation.h"
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.