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/] [obj-c++.dg/] [lookup-2.mm] - Diff between revs 308 and 338

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 308 Rev 338
/* { dg-do run } */
/* { dg-do run } */
/* { dg-xfail-if "PR23614" { "*-*-*" } { "*" } { "-fnext-runtime" } } */
/* { dg-xfail-if "PR23614" { "*-*-*" } { "*" } { "-fnext-runtime" } } */
/* { 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 "../objc-obj-c++-shared/Object1.h"
#include "../objc-obj-c++-shared/Object1.h"
#include 
#include 
class MyWidget {
class MyWidget {
 public:
 public:
  int a;
  int a;
  MyWidget(void) { a = 17; }
  MyWidget(void) { a = 17; }
};
};
MyWidget gWidget;
MyWidget gWidget;
@protocol MyProto
@protocol MyProto
- (MyWidget *)widget;
- (MyWidget *)widget;
@end
@end
@interface Foo: Object
@interface Foo: Object
@end
@end
@interface Bar: Foo 
@interface Bar: Foo 
@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 = nil;
    MyWidget *widget = nil;
    if ([view conformsTo:@protocol(MyProto)]) {
    if ([view conformsTo:@protocol(MyProto)]) {
        widget = [(Foo  *)view widget];
        widget = [(Foo  *)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.