aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/pr109524.C
blob: 644c7574e867843c205cdf9a8813920cf2466336 (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
33
34
35
36
37
38
39
40
41
// { dg-do compile }
// { dg-require-effective-target c++11 }
// { dg-options "-O3 -fno-tree-forwprop -fnon-call-exceptions -fno-tree-ccp -fno-tree-fre" }

struct nn;
void f();
int *m;
struct _Guard {
        ~_Guard() {
          if (_M_guarded)
                  __builtin_unreachable();
        }
        nn *_M_guarded;
};
struct nn {
  int * _M_dataplus;
  nn(const nn &)
        {
                f();
                _Guard   __guard;
                m = _M_dataplus;
        }
  nn(){}
};
  void hnn(nn *a)
        {
                f();
                _Guard   __guard;
                m = a->_M_dataplus;
        }
bool gg();
static inline nn
hh(nn str) {
  if (gg())
    return str;
  __builtin_unreachable();
}
void h() {

  hh({});
}