summaryrefslogtreecommitdiff
path: root/gcc/testsuite/obj-c++.dg/torture/strings/const-str-4.mm
blob: c2cadd3df96cb61924b8c5258309270ae64aeec2 (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
31
32
33
/* Ensure that the preprocessor handles ObjC string constants gracefully. */
/* Author: Ziemowit Laski <zlaski@apple.com> */

/* { dg-do run  { target *-*-darwin* } } */
/* { dg-options "-fconstant-string-class=MyString" } */ 
/* { dg-options "-mno-constant-cfstrings -fconstant-string-class=MyString" { target *-*-darwin* } } */

#include <stdlib.h>

@interface MyString
{
  void *isa;
  char *str;
  int len;
}
@end

#define kMyStringMacro1 "My String"
#define kMyStringMacro2 @"My String"

void *_MyStringClassReference;

@implementation MyString
@end

int main(void) {
  MyString* aString1 = @kMyStringMacro1;
  MyString* aString2 = kMyStringMacro2;
  if(aString1 != aString2) {
    abort();
  }
  return 0;
}