1 /* Test for warnings for qualified function return types. */
2 /* Origin: Joseph Myers <jsm28@cam.ac.uk> */
3 /* { dg-do compile } */
4 /* { dg-options "-std=gnu99 -Wreturn-type" } */
6 /* Qualifying a function return type makes no sense. */
8 const int int_fn (void); /* { dg-warning "qualifiers" "int decl" } */
9 const int (*int_ptr
) (void); /* { dg-warning "qualifiers" "int ptr" } */
10 const int int_fn2 (void) { return 0; } /* { dg-warning "qualifiers" "int defn" } */
12 const void void_fn (void); /* { dg-warning "qualifiers" "void decl" } */
13 const void (*void_ptr
) (void); /* { dg-warning "qualifiers" "void ptr" } */
14 const void void_fn2 (void) { } /* { dg-warning "qualified" "void defn" } */
16 volatile void vvoid_fn (void); /* { dg-warning "qualifiers" "void decl" } */
17 volatile void (*vvoid_ptr
) (void); /* { dg-warning "qualifiers" "void ptr" } */
18 volatile void vvoid_fn2 (void) { } /* { dg-warning "qualified" "void defn" } */
20 int *restrict
ip_fn (void); /* { dg-warning "qualifiers" "restrict decl" } */
21 int *restrict (*ip_ptr
) (void); /* { dg-warning "qualifiers" "restrict ptr" } */
22 int *restrict
ip_fn2 (void) { return (int *)0; }; /* { dg-warning "qualifiers" "restrict defn" } */