aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/objc.dg/gnu-runtime-2.m
blob: 9903d29727c72040befdd862472ae280bdf23483 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/* Sanity check for GNU-runtime version of constant strings,
   regardless of runtime used on target system.  */

/* { dg-do compile } */
/* { dg-skip-if "" { *-*-* } { "-fnext-runtime" } { "" } } */

#include <objc/Object.h>
#include <string.h>
#include <stdlib.h>

@interface NXConstantString: Object
{
  char *c_string;
  unsigned int len;                                                     
}
-(const char *) cString;
-(unsigned int) length;
@end

@implementation NXConstantString
-(const char *) cString { return c_string; }
-(unsigned int) length  { return len; }
@end

int main(int argc, void **args)
{
  if (strcmp ([@"this is a string" cString], "this is a string"))
    abort ();
  return 0;
}