Merge from mainline, version 106440, to sh-elf-4_1-branch .
[official-gcc.git] / gcc / testsuite / g++.dg / ext / dllimport7.C
blob9754ada962c2aa99cd598a4819c490ad159c8040
1 // { dg-do compile { target i?86-*-cygwin* i?86-*-mingw*} }
3 //  Report errors on definition of dllimport'd static data member . 
6 struct Baz
8   Baz(int a_ =0) : a(a_) {}; 
9   int a;
12 class  __declspec(dllimport) Bar
14   public:
15     enum {one = 1};
16     static const int two = 2;
17     static const int three;
18     static const Baz null_baz;
21 const int Bar::three = 3;       //  { dg-warning "redeclared without dllimport" }
22 //  { dg-error "definition of static data" "C++ specific error" { target i?86-*-cygwin* i?86-*-mingw* } 21 }
23                                 
24 const Baz Bar::null_baz;        //  { dg-warning "redeclared without dllimport" }
25 //  { dg-error "definition of static data" "C++ specific error" { target i?86-*-cygwin* i?86-*-mingw* }  24 }
29 int foo()
31   Bar foobar;
32   const int* baz = &Bar::two; 
33   int a = foobar.two;
34   int b = foobar.three;
35   int c = foobar.null_baz.a;
36   return (a + b + c + *baz);