summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/init/value9.C
blob: 4899bd81001af029199e24062a4546378643a2a5 (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
31
32
// PR c++/50793
// { dg-do run }

struct NonTrivial
{
  NonTrivial() { }
};

struct S
{
  NonTrivial nt;
  int i;
};

int f(S s)
{
  s.i = 0xdeadbeef;
  return s.i;
}

int g(S s = S())
{
  return s.i;
}

int main()
{
  f(S());  // make stack dirty

  if ( g() )
    __builtin_abort();
}