aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/qual-return-5.c
blob: 32a08f217d06007cb93df87c675ebf52f884fcd2 (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
25
26
27
28
29
30
31
32
/* Test qualifiers on function return types after DR#423: those
   qualifiers are now ignored for all purposes (but _Atomic is not,
   for this purpose, a qualifier).  */
/* { dg-do compile } */
/* { dg-options "-std=c11 -pedantic-errors" } */

int f1 (void);
const int f1 (void);
volatile int f1 (void) { return 0; }

int *restrict f2 (void) { return 0; }
int *f2 (void);

const volatile long f3 (void);
long f3 (void);

const volatile void f4 (void) { }
void f4 (void);

_Atomic int f5 (void); /* { dg-message "previous declaration" } */
int f5 (void); /* { dg-error "conflicting" } */

int f6 (void); /* { dg-message "previous declaration" } */
_Atomic int f6 (void) { return 0; } /* { dg-error "conflicting" } */

/* The standard seems unclear regarding the case where restrict is
   applied to a function return type that may not be
   restrict-qualified; assume here that it is disallowed.  */
restrict int f7 (void); /* { dg-error "restrict" } */

typedef void FT (void);
FT *restrict f8 (void); /* { dg-error "restrict" } */