summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/bad-dereference.c
blob: 5f8188dbccd8a191d774c37060d1a132765fa25c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/* { dg-options "-fdiagnostics-show-caret" } */

struct foo
{
  int x;
};

int test_1 (struct foo some_f)
{
  return *some_f.x; /* { dg-error "invalid type argument of unary ... .have .int.." } */
/* { dg-begin-multiline-output "" }
   return *some_f.x;
          ^~~~~~~~~
   { dg-end-multiline-output "" } */
}

int test_2 (struct foo some_f)
{
  return *some_f; /* { dg-error "invalid type argument of unary ... .have .struct foo.." } */
/* { dg-begin-multiline-output "" }
   return *some_f;
          ^~~~~~~
   { dg-end-multiline-output "" } */
}