1 // RUN: %clang_cc1 -fsyntax-only -fobjc-runtime=macosx-fragile-10.5 -verify -Wno-objc-root-class %s
2 // RUN: %clang_cc1 -fsyntax-only -fobjc-runtime=macosx-fragile-10.5 -verify -Wno-objc-root-class -std=c++98 %s
3 // RUN: %clang_cc1 -fsyntax-only -fobjc-runtime=macosx-fragile-10.5 -verify -Wno-objc-root-class -std=c++11 %s
12 [x method]; // expected-error{{receiver type 'x' is not an Objective-C class}}
17 typedef struct { int x; } ivar;
32 I2 *operator+(I2_holder, int);
38 // Test instance messages that start with a simple-type-specifier.
39 [I2_holder().get() method];
40 [I2_holder().get() + 17 method];
44 [ivar method]; // expected-error{{receiver type 'ivar' is not an Objective-C class}}
48 // Class message sends
63 + (int *)otherMethod {
64 // Test class messages that use non-trivial simple-type-specifiers
65 // or typename-specifiers.
68 return [typename identity<I3>::type method];
69 #if __cplusplus <= 199711L
70 // expected-warning@-2 {{'typename' occurs outside of a template}}
76 int* ip1 = {[super method]};
77 int* ip2 = {[::I3 method]};
78 int* ip3 = {[typename identity<I3>::type method]};
79 #if __cplusplus <= 199711L
80 // expected-warning@-2 {{'typename' occurs outside of a template}}
83 int* ip4 = {[typename identity<I2_holder>::type().get() method]};
84 #if __cplusplus <= 199711L
85 // expected-warning@-2 {{'typename' occurs outside of a template}}
87 int array[5] = {[3] = 2}; // expected-warning {{C99 extension}}
88 return [super method];
96 struct MutableString : public String { };
98 // C++-specific parameter types
100 - method:(const String&)str1
101 other:(String&)str2; // expected-note{{passing argument to parameter 'str2' here}}
104 void test_I5(I5 *i5, String s) {
105 [i5 method:"hello" other:s];
106 [i5 method:s other:"world"]; // expected-error{{non-const lvalue reference to type 'String' cannot bind to a value of unrelated type 'const char[6]'}}
113 + (A *)create:(void (*)(void *x, X r, void *data))callback
114 callbackData:(void *)callback_data;
124 A *im = [A create:(void (*)(void *cgl_ctx, X r, void *data)) fun
128 template<typename T> struct X1; // expected-note{{template is declared here}}
136 [B blah]; // expected-error{{implicit instantiation of undefined template 'X1<int>'}}