xref: /minix3/external/bsd/llvm/dist/clang/test/Sema/member-reference.c (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 %s -verify -fsyntax-only
2*f4a2713aSLionel Sambuc 
3*f4a2713aSLionel Sambuc struct simple { int i; };
4*f4a2713aSLionel Sambuc 
f(void)5*f4a2713aSLionel Sambuc void f(void) {
6*f4a2713aSLionel Sambuc    struct simple s[1];
7*f4a2713aSLionel Sambuc    s->i = 1;
8*f4a2713aSLionel Sambuc }
9*f4a2713aSLionel Sambuc 
10*f4a2713aSLionel Sambuc typedef int x;
11*f4a2713aSLionel Sambuc struct S {
12*f4a2713aSLionel Sambuc   int x;
13*f4a2713aSLionel Sambuc   x z;
14*f4a2713aSLionel Sambuc };
15*f4a2713aSLionel Sambuc 
g(void)16*f4a2713aSLionel Sambuc void g(void) {
17*f4a2713aSLionel Sambuc   struct S s[1];
18*f4a2713aSLionel Sambuc   s->x = 1;
19*f4a2713aSLionel Sambuc   s->z = 2;
20*f4a2713aSLionel Sambuc }
21*f4a2713aSLionel Sambuc 
PR17762(struct simple c)22*f4a2713aSLionel Sambuc int PR17762(struct simple c) {
23*f4a2713aSLionel Sambuc   return c->i; // expected-error {{member reference type 'struct simple' is not a pointer; maybe you meant to use '.'?}}
24*f4a2713aSLionel Sambuc }
25