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

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [gcc/] [testsuite/] [objc/] [execute/] [exceptions/] [foward-1.m] - Rev 12

Compare with Previous | Blame | View Log

/* Check that throwing an exception from a -forward:: works.  */
/* Developed by Marcin Koziej <creep@desk.pl>.  */
 
#import <objc/Object.h>
#import <objc/objc-api.h>
#include <stdlib.h>
 
static int i;
 
@interface Thrower : Object
- forward: (SEL) s : (void*) a;
@end
 
@implementation Thrower
- forward: (SEL) s : (void*) a
{
  i++;
  @throw [Object new];
}
@end
int
main()
{
  id t = [Thrower new];
  @try
  {
    [t doesnotexist];
  }
  @catch (id error)
  {
    i++;
    [error free];
  }
 
  if (i != 2)
    abort ();
 
  return 0;
}
 

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.