xref: /llvm-project/clang/test/SemaObjC/encode-typeof-test.m (revision 0f1c1be1968076d6f96f8a7bcc4a15cf195ecd97)
1// RUN: %clang_cc1  -fsyntax-only -verify -Wno-objc-root-class %s
2@protocol X, Y, Z;
3@class Foo;
4
5@protocol Proto
6@end
7
8@interface Intf <Proto>
9{
10id <X> IVAR_x;
11id <X, Y> IVAR_xy;
12id <X, Y, Z> IVAR_xyz;
13Foo <X, Y, Z> *IVAR_Fooxyz;
14Class <X> IVAR_Classx;
15}
16@end
17
18@implementation Intf
19@end
20
21int main(void)
22{
23    int i;
24    typeof(@encode(typeof(i))) e = @encode(typeof(Intf)); // expected-warning {{initializer-string for char array is too long}}
25}
26
27typedef short short8 __attribute__((ext_vector_type(8)));
28
29struct foo {
30 char a;
31 int b;
32 long c;
33 short8 d;
34 int array[4];
35 short int bitfield1:5;
36 unsigned short bitfield2:11;
37 char *string;
38};
39
40const char *RetEncode (void) {
41 return @encode(struct foo); // expected-warning {{encoding of 'struct foo' type is incomplete because 'short8' (vector of 8 'short' values) component has unknown encoding}}
42}
43
44