xref: /minix3/external/bsd/llvm/dist/clang/test/PCH/struct.c (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // Test this without pch.
2*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -include %S/struct.h -fsyntax-only -verify %s
3*f4a2713aSLionel Sambuc 
4*f4a2713aSLionel Sambuc // Test with pch.
5*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -emit-pch -o %t %S/struct.h
6*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -include-pch %t -fsyntax-only -verify %s
7*f4a2713aSLionel Sambuc 
8*f4a2713aSLionel Sambuc struct Point *p1;
9*f4a2713aSLionel Sambuc 
getX(struct Point * p1)10*f4a2713aSLionel Sambuc float getX(struct Point *p1) {
11*f4a2713aSLionel Sambuc   return p1->x;
12*f4a2713aSLionel Sambuc }
13*f4a2713aSLionel Sambuc 
get_fun_ptr()14*f4a2713aSLionel Sambuc void *get_fun_ptr() {
15*f4a2713aSLionel Sambuc   return fun->is_ptr? fun->ptr : 0;
16*f4a2713aSLionel Sambuc }
17*f4a2713aSLionel Sambuc 
18*f4a2713aSLionel Sambuc struct Fun2 {
19*f4a2713aSLionel Sambuc   int very_fun;
20*f4a2713aSLionel Sambuc };
21*f4a2713aSLionel Sambuc 
get_very_fun()22*f4a2713aSLionel Sambuc int get_very_fun() {
23*f4a2713aSLionel Sambuc   return fun2->very_fun;
24*f4a2713aSLionel Sambuc }
25*f4a2713aSLionel Sambuc 
26*f4a2713aSLionel Sambuc int *int_ptr_fail = &fun->is_ptr; // expected-error{{address of bit-field requested}}
27*f4a2713aSLionel Sambuc 
28*f4a2713aSLionel Sambuc struct Nested nested = { 1, 2 };
29