1 /* { dg-do compile } */
10 int test (struct foo *ptr)
12 return ptr->m_bar; /* { dg-error "'struct foo' has no member named 'm_bar'; did you mean 'bar'?" } */
17 struct foo instance = {0, 0, 0};
18 return instance.m_bar; /* { dg-error "'struct foo' has no member named 'm_bar'; did you mean 'bar'?" } */
22 struct j { int aa; } kk;
26 void test3 (struct s x)
28 x.ac; /* { dg-error "'struct s' has no member named 'ac'; did you mean 'ab'?" } */
31 int test4 (struct foo *ptr)
33 return sizeof (ptr->foa); /* { dg-error "'struct foo' has no member named 'foa'; did you mean 'foo'?" } */
36 /* Verify that we don't offer nonsensical suggestions. */
38 int test5 (struct foo *ptr)
40 return ptr->this_is_unlike_any_of_the_fields; /* { dg-bogus "did you mean" } */
41 /* { dg-error "has no member named" "" { target *-*-* } .-1 } */
50 int test6 (union u *ptr)
52 return ptr->colour; /* { dg-error "'union u' has no member named 'colour'; did you mean 'color'?" } */
57 struct { int color; } s;
60 int test7 (struct has_anon *ptr)
62 return ptr->s.colour; /* { dg-error "'struct has_anon::<unnamed>' has no member named 'colour'; did you mean 'color'?" } */
67 return ref.m_bar; /* { dg-error "'struct foo' has no member named 'm_bar'; did you mean 'bar'?" } */
70 struct bar : public foo
78 return ptr->fuzz; /* { dg-error "'struct bar' has no member named 'fuzz'; did you mean 'fizz'?" } */
83 return ptr->m_foo; /* { dg-error "'struct bar' has no member named 'm_foo'; did you mean 'foo'?" } */
88 return ptr->mytype; /* { dg-error "'struct bar' has no member named 'mytype'; did you mean 'my_type'?" } */