Home | History | Annotate | Download | only in Parser
      1 // RUN: %clang_cc1 -fsyntax-only -verify %s
      2 
      3 @interface NSString @end
      4 
      5 @interface NSString (NSStringExtensionMethods)
      6 + (id)stringWithUTF8String:(const char *)nullTerminatedCString;
      7 @end
      8 
      9 extern char *strdup(const char *str);
     10 
     11 id constant_string() {
     12     return @("boxed constant string.");
     13 }
     14 
     15 id dynamic_string() {
     16     return @(strdup("boxed dynamic string"));
     17 }
     18 
     19 id const_char_pointer() {
     20     return @((const char *)"constant character pointer");
     21 }
     22 
     23 id missing_parentheses() {
     24     return @(5;             // expected-error {{expected ')'}} \
     25                             // expected-note {{to match this '('}}
     26 }
     27 
     28 // rdar://10679157
     29 void bar(id p);
     30 void foo(id p) {
     31         bar(@{p, p}); // expected-error {{expected ':'}}
     32         bar(0);
     33         bar(0);
     34 }
     35