summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/ext/gnu-inline-global-reject.C
blob: d9e26609550e8da5e485804d775c75489a703050 (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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/* Test __attribute__((gnu_inline)).

   Check that we reject various forms of duplicate definitions.
*/

/* { dg-do compile } */
/* { dg-options " -ansi -Wno-long-long" } */

#include "gnu-inline-common.h"

#undef fn
#define fn pfx(func_decl_inline_before)
decl(inline, fn) // { dg-error "previous" "" }
gnuindef(fn, 0) // { dg-error "redeclared" "" }

#undef fn
#define fn pfx(func_decl_inline_after)
gnuindef(fn, 0) // { dg-error "previous" "" }
decl(inline, fn) // { dg-error "redeclared" "" }

#undef fn
#define fn pfx(func_def_gnuin_redef)
gnuindef(fn, 0) // { dg-error "previous" "" }
gnuindef(fn, 1) // { dg-error "redefinition" "" }

#undef fn
#define fn pfx(func_def_inline_redef)
def(inline, fn, 0) // { dg-error "previous" "" }
def(inline, fn, 1) // { dg-error "redefinition" "" }

#undef fn
#define fn pfx(func_def_inline_after)
gnuindef(fn, 0) // { dg-error "previous" "" }
def(inline, fn, 1) // { dg-error "redeclare" "" }

#undef fn
#define fn pfx(func_def_inline_before)
def(inline, fn, 0) // { dg-error "previous" "" }
gnuindef(fn, 1) // { dg-error "redefinition" "" }

#undef fn
#define fn pfx(func_def_before)
def(, fn, 0) // { dg-error "previous" "" }
gnuindef(fn, 1) // { dg-error "redefinition" "" }

#undef fn
#define fn pfx(func_decl_static_inline_before)
decl(static inline, fn) // { dg-error "previous" "" }
gnuindef(fn, 0) // { dg-error "redeclared" "" }

#undef fn
#define fn pfx(func_def_static_inline_after)
decl(static, fn)
gnuindef(fn, 0) // { dg-error "previous" "" }
decl(static, fn)
def(static inline, fn, 1) // { dg-error "redeclare" "" }