aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/ext/selectany1.C
blob: e80fe4fd10c02ac4da8e695d36eff2fdae9db70d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// { dg-do compile { target i?86-pc-cygwin } }
// { dg-do compile { target i?86-*-mingw* x86_64-*-mingw* } }

// Check that selectany attribute puts symbols into link-once sections.

// { dg-final { scan-assembler "\.section\t\.data\\\$foo\[^\n\]*\n\t\.linkonce discard" } }
// { dg-final { scan-assembler "\.section\t\.data\\\$x\[^\n\]*\n\t\.linkonce discard" } }

__declspec (selectany) int foo = 1;

class X
{
private:
  int m_i;
public:
  X(int i): m_i(i){}
  ~X(){}
};

__declspec(selectany) X x(1);