| 1 |
/* Contributed by Nicola Pero <[email protected]>, November 2010. */ |
| 2 |
/* { dg-do compile } */ |
| 3 |
|
| 4 |
#include "../../objc-obj-c++-shared/runtime.h" |
| 5 |
#ifndef __NEXT_RUNTIME__ |
| 6 |
#include <objc/NXConstStr.h> |
| 7 |
#endif |
| 8 |
|
| 9 |
/* The following are correct. */ |
| 10 |
id test_valid1 = @"test"; |
| 11 |
id test_valid2 = @"te" @"st"; |
| 12 |
id test_valid3 = @"te" @"s" @"t"; |
| 13 |
id test_valid4 = @ "t" @ "e" @ "s" @ "t"; |
| 14 |
|
| 15 |
/* The following are accepted too; you can concat an ObjC string to a |
| 16 |
C string, the result being an ObjC string. */ |
| 17 |
id test_valid5 = @"te" "st"; |
| 18 |
id test_valid6 = @"te" "s" @"t"; |
| 19 |
id test_valid7 = @"te" @"s" "t"; |
| 20 |
|
| 21 |
/* The following are not correct. */ |
| 22 |
id test_invalid1 = @@"test"; /* { dg-error "stray .@. in program" } */ |
| 23 |
const char *test_invalid2 = "test"@; /* { dg-error "stray .@. in program" } */ |
| 24 |
const char *test_invalid3 = "test"@@; /* { dg-error "stray .@. in program" } */ |
| 25 |
const char *test_invalid4 = "te" @"st"; /* { dg-error "expected" } */ |
| 26 |
id test_invalid5 = @"te" @@"st"; /* { dg-error "repeated .@. before Objective-C string" } */ |
| 27 |
id test_invalid6 = @@"te" @"st"; /* { dg-error "stray .@. in program" } */ |
| 28 |
id test_invalid7 = @"te" @"s" @@"t"; /* { dg-error "repeated .@. before Objective-C string" } */ |
| 29 |
id test_invalid8 = @"te" @@"s" @"t"; /* { dg-error "repeated .@. before Objective-C string" } */ |
| 30 |
id test_invalid9 = @"te" @"s" @"t" @; /* { dg-error "stray .@. in program" } */ |
| 31 |
id test_invalidA = @"te" @ st; /* { dg-error "stray .@. in program" } */ |
| 32 |
/* { dg-error "expected" "" { target *-*-* } .-1 } */ |