summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/ext/dllimport6.C
blob: 52b0476c6d0555d2b34ab0ec19c8c732af628447 (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-*-cygwin* i?86-*-mingw* x86_64-*-mingw* } }
//  Mark class static members as dllimport.

struct Baz
{
  Baz(int a_ =0) : a(a_) {}
  int a;
};

class  __attribute__ ((dllimport)) Bar
{
  public:
    static const int two = 2;
    static const int three;
    static const Baz null_baz;
};

int foo()
{
  Bar foobar;
  const int* baz = &Bar::two; 
  int a = foobar.two;
  int b = foobar.three;
  int c = foobar.null_baz.a;
  return (a + b + c + *baz);
}

// { dg-final { scan-assembler __imp\[_\]*__ZN3Bar3twoE } }
// { dg-final { scan-assembler __imp\[_\]*__ZN3Bar5threeE } }
// { dg-final { scan-assembler __imp\[_\]*__ZN3Bar8null_bazE } }