summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.jason/pmf9.C
blob: 6d86498cf14c5238419fe4d48d29957984bf3115 (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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// { dg-do assemble  }
// PRMS id: g++/13340

class rectangle {
    
public:
  rectangle();
  int overlaps() const;

};

class region 
{
  friend class region_impl;

public:
  region();
  typedef int (region::* region_func)() const;      

};

class region_impl  {
  friend class region;

private:
  rectangle content, mbb;
  region_impl *link_p;
  region_impl(const rectangle &content);

public:
  int iterate(region *region_p, region::region_func what,
	      const rectangle &clip_rect) const;
  int iterate(region *region_p, region::region_func what,
	      const region_impl &clip_rgn) const;
};


int
region_impl::iterate (region *region_p, region::region_func what, 
		      const rectangle &clip_rect) const
{
  for (const region_impl *p = this; p != 0 && p->mbb.overlaps();
       p = p->link_p)
    if (p->content.overlaps())
      if (!(region_p->*what)()) return 0;
  return 1;
}

int
region_impl::iterate (region *region_p, region::region_func what,
		      const region_impl &clip_rgn) const
{
  for (const region_impl *p = this; p != 0 && p->mbb.overlaps();
       p = p->link_p)
    if (!clip_rgn.iterate(region_p, what, p->content)) return 0;
  return 1;
}