1// Test this without pch.
2// RUN: %clang_cc1 -fblocks -include %S/types.h -fsyntax-only -verify %s
3
4// Test with pch.
5// RUN: %clang_cc1 -emit-pch -fblocks -o %t %S/types.h
6// RUN: %clang_cc1 -fblocks -include-pch %t -fsyntax-only -verify %s -ast-print
7
8typedef int INT;
9INT int_value;
10
11__attribute__((address_space(1))) int int_as_one;
12
13// TYPE_EXT_QUAL
14ASInt *as_int_ptr1 = &int_value;  // expected-error{{changes address space of pointer}}
15ASInt *as_int_ptr2 = &int_as_one;
16
17// TYPE_COMPLEX
18_Complex float Cfloat_val;
19Cfloat *Cfloat_ptr = &Cfloat_val;
20
21// TYPE_ATOMIC
22_Atomic(int) AtomicInt_val;
23AtomicInt *AtomicInt_ptr = &AtomicInt_val;
24
25// TYPE_POINTER
26int_ptr int_value_ptr = &int_value;
27
28// TYPE_BLOCK_POINTER
29void test_block_ptr(Block *bl) {
30  *bl = ^(int x, float f) { return x; };
31}
32
33// TYPE_CONSTANT_ARRAY
34five_ints fvi = { 1, 2, 3, 4, 5 };
35
36// TYPE_INCOMPLETE_ARRAY
37float_array fa1 = { 1, 2, 3 };
38float_array fa2 = { 1, 2, 3, 4, 5, 6, 7, 8 };
39
40// TYPE_VARIABLE_ARRAY in stmts.[ch]
41
42// TYPE_VECTOR
43float4 f4 = { 1.0, 2.0, 3.0, 4.0 };
44
45// TYPE_EXT_VECTOR
46ext_float4 ef4 = { 1.0, 2.0, 3.0, 4.0 };
47
48// TYPE_FUNCTION_NO_PROTO
49noproto np1;
50int np1(x, y)
51     int x;
52     float y;
53{
54  return x;
55}
56
57// TYPE_FUNCTION_PROTO
58proto p1;
59float p1(float x, float y, ...) {
60  return x + y;
61}
62proto *p2 = p1;
63
64// TYPE_TYPEDEF
65int_ptr_ptr ipp = &int_value_ptr;
66
67// TYPE_TYPEOF_EXPR
68typeof_17 *t17 = &int_value;
69struct S { int x, y; };
70typeof_17 t17_2 = (struct S){1, 2}; // expected-error{{initializing 'typeof_17' (aka 'int') with an expression of incompatible type 'struct S'}}
71
72// TYPE_TYPEOF
73int_ptr_ptr2 ipp2 = &int_value_ptr;
74