blob: 278b32d2f4bab7efdffc97146ebc9a06c910ec0d (
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
|
// { dg-do compile { target i?86-pc-cygwin } }
// { dg-do compile { target i?86-*-mingw* x86_64-*-mingw* } }
// Check for errors with invalid usage of selectany attribute.
extern int foo;
__declspec (selectany) int foo = 1; // OK
struct d
{
static int foo;
};
__declspec (selectany) int d::foo = 1; // OK
struct f
{
int i;
};
__declspec (selectany) struct f F= {1}; // OK
__declspec (selectany) int boo; //{ dg-error "selectany" }
__declspec (selectany) static int bar = 1; // { dg-error "selectany" }
int use_bar = bar; // Avoid defined but not used warning.
int baz()
{
__declspec (selectany) int foo = 1; // { dg-error "selectany" }
return foo;
}
|