| 1 |
// { dg-do compile { target i?86-*-cygwin* i?86-*-mingw* x86_64-*-mingw* } } |
| 2 |
|
| 3 |
// PR 10148 Dllimport attribute of object is overriden by later |
| 4 |
// redefinition without attribute. |
| 5 |
|
| 6 |
struct Foo |
| 7 |
{ |
| 8 |
int a; |
| 9 |
}; |
| 10 |
|
| 11 |
__attribute__((dllimport)) struct Foo f; |
| 12 |
|
| 13 |
void Bar(void) |
| 14 |
{ |
| 15 |
void* dummy = (void*) &f; |
| 16 |
} |
| 17 |
|
| 18 |
struct Foo f; // { dg-warning "referenced with dll linkage" } |
| 19 |
|
| 20 |
// Dllimport'd symbols do not have a constant address, so following |
| 21 |
// assignment would require static_initialization_and_destruction |
| 22 |
// if attribute is retained. |
| 23 |
|
| 24 |
void* dummy = &f; |