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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [obj-c++.dg/] [property/] [dynamic-3.mm] - Rev 703

Compare with Previous | Blame | View Log

/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, November 2010.  */
/* { dg-do compile } */

#include <objc/objc.h>

@interface MyRootClass
{
  Class isa;
}
@end

@implementation MyRootClass
@end

/* Test @property/@dynamic in a category.  First, a case where
   @dynamic should turn off all warnings.  */

@interface MyRootClass (Category)
@property int a;
- (int) test;
@end
@implementation MyRootClass (Category)
@dynamic a;
- (int) test
{
  return self.a; /* This should compile into [self a] with no warnings.  */
}
@end



/* Test @property/@dynamic in a category.  Second, a case with a
   missing setter and no @dynamic.  A warning should be generated.  */

@interface MyRootClass (Category2)
@property int b;
- (int) test;
@end
@implementation MyRootClass (Category2)
- (int) b
{
  return 0;
}
- (int) test
{
  return self.b;
}
@end /* { dg-warning "incomplete implementation" } */
/* { dg-warning "method definition for .-setB:. not found" "" { target *-*-* } 48 } */

Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

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