Debian Codegraph @

gcc/testsuite/g++.dg/ext/selectany2.C

raw
1 // { dg-do compile { target i?86-pc-cygwin } }
2 // { dg-do compile { target i?86-*-mingw* x86_64-*-mingw* } }
3
4 // Check for errors with invalid usage of selectany attribute.
5
6 extern int foo;
7 __declspec (selectany) int foo = 1; // OK
8
9 struct d
10 {
11 static int foo;
12 };
13 __declspec (selectany) int d::foo = 1; // OK
14
15 struct f
16 {
17 int i;
18 };
19 __declspec (selectany) struct f F= {1}; // OK
20
21 __declspec (selectany) int boo; // OK
22
23 __declspec (selectany) static int bar = 1; // { dg-error "selectany" }
24 int use_bar = bar; // Avoid defined but not used warning.
25
26 int baz()
27 {
28 __declspec (selectany) int foo = 1; // { dg-error "selectany" }
29 return foo;
30 }