summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/tree-ssa/fold-compare.C
blob: 2b4c41103baf2d62dd393ecef9de933264c73e45 (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
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-optimized" } */

struct ExtentsBase {
 ExtentsBase() : startx_(), endx_() { }
 ExtentsBase(const ExtentsBase &b) {
  *this = b;
 }

 const ExtentsBase & operator=(const ExtentsBase &b) {
  if (this != &b) {
    startx_ = b.startx_;
  }
  return *this;
 }

 int startx_;
  int endx_;
};

int f(const ExtentsBase &e1) {
 ExtentsBase my_extents = e1;
 return my_extents.startx_;
}

/* { dg-final { scan-tree-dump-not "&my_extents" "optimized" } } */
/* { dg-final { cleanup-tree-dump "optimized" } } */