(root)/
gcc-13.2.0/
gcc/
testsuite/
c-c++-common/
Wcast-function-type.c
       1  /* { dg-do compile } */
       2  /* { dg-options "-Wcast-function-type" } */
       3  
       4  int f(long);
       5  
       6  typedef int (f1)(long);
       7  typedef int (f2)(void*);
       8  #ifdef __cplusplus
       9  typedef int (f3)(...);
      10  typedef void (f4)(...);
      11  #else
      12  typedef int (f3)();
      13  typedef void (f4)();
      14  #endif
      15  typedef void (f5)(void);
      16  
      17  f1 *a;
      18  f2 *b;
      19  f3 *c;
      20  f4 *d;
      21  f5 *e;
      22  
      23  void
      24  foo (void)
      25  {
      26    a = (f1 *) f; /* { dg-bogus   "incompatible function types" } */
      27    b = (f2 *) f; /* { dg-warning "7:cast between incompatible function types" } */
      28    c = (f3 *) f; /* { dg-bogus   "incompatible function types" } */
      29    d = (f4 *) f; /* { dg-warning "7:cast between incompatible function types" } */
      30    e = (f5 *) f; /* { dg-bogus   "incompatible function types" } */
      31  }