1/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, 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. */ 10id test_valid1 = @"test"; 11id test_valid2 = @"te" @"st"; 12id test_valid3 = @"te" @"s" @"t"; 13id 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. */ 17id test_valid5 = @"te" "st"; 18id test_valid6 = @"te" "s" @"t"; 19id test_valid7 = @"te" @"s" "t"; 20 21/* The following are not correct. */ 22id test_invalid1 = @@"test"; /* { dg-error "stray .@. in program" } */ 23const char *test_invalid2 = "test"@; /* { dg-error "stray .@. in program" } */ 24const char *test_invalid3 = "test"@@; /* { dg-error "stray .@. in program" } */ 25const char *test_invalid4 = "te" @"st"; /* { dg-error "expected" } */ 26id test_invalid5 = @"te" @@"st"; /* { dg-error "repeated .@. before Objective-C string" } */ 27id test_invalid6 = @@"te" @"st"; /* { dg-error "stray .@. in program" } */ 28id test_invalid7 = @"te" @"s" @@"t"; /* { dg-error "repeated .@. before Objective-C string" } */ 29id test_invalid8 = @"te" @@"s" @"t"; /* { dg-error "repeated .@. before Objective-C string" } */ 30id test_invalid9 = @"te" @"s" @"t" @; /* { dg-error "stray .@. in program" } */ 31id test_invalidA = @"te" @ st; /* { dg-error "stray .@. in program" } */ 32 /* { dg-error "expected" "" { target *-*-* } .-1 } */ 33