summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/diagnostic-range-bad-called-object.c
blob: 0f7fd2a28569584fa60796c254a506450b2bedb8 (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" } */

/* Adapted from https://gcc.gnu.org/wiki/ClangDiagnosticsComparison */

void call_of_non_function_ptr (char **argP, char **argQ)
{
  (argP - argQ)(); /* { dg-error "called object is not a function or function pointer" } */

/* { dg-begin-multiline-output "" }
   (argP - argQ)();
   ~~~~~~^~~~~~~
   { dg-end-multiline-output "" } */

  argP();       /* { dg-error "called object 'argP' is not a function or function pointer" } */

/* { dg-begin-multiline-output "" }
   argP();
   ^~~~
   { dg-end-multiline-output "" }
   { dg-begin-multiline-output "" }
 void call_of_non_function_ptr (char **argP, char **argQ)
                                ~~~~~~~^~~~
   { dg-end-multiline-output "" } */
}