Merged r157653 through r157895 into branch.
[official-gcc.git] / gcc / testsuite / g++.dg / torture / pr42183.C
blob375b37f0c668628673c27ce8687a7bd427869de4
1 // { dg-do compile }
3 class IntSize {
4 public:
5     IntSize(int width, int height) : m_width(width), m_height(height) { }
6     int m_width, m_height;
7 };
8 class IntPoint {
9 public:
10     IntPoint(int x, int y) : m_x(x), m_y(y) { }
11     int m_x, m_y;
13 class IntRect {
14 public:
15     IntRect(int x, int y, int width, int height)
16         : m_location(IntPoint(x, y)), m_size(IntSize(width, height)) { }
17     void intersect(const IntRect&);
18     IntPoint m_location;
19     IntSize m_size;
21 inline IntRect intersection(const IntRect& a, const IntRect& b) {
22     IntRect c = a;
23     c.intersect(b);
24     return c;
26 class RenderObject  {
27 public:
28     int contentWidth() const { }
29     int contentHeight() const { }
30     virtual int xPos() const { }
31     virtual int yPos() const { }
32     virtual int paddingTop() const;
33     virtual int paddingLeft() const;
34     virtual int borderTop() const { }
35     virtual int borderLeft() const { }
37 class RenderMenuList : public RenderObject {
38     virtual IntRect controlClipRect(int tx, int ty) const;
39     RenderObject* m_innerBlock;
41 IntRect RenderMenuList::controlClipRect(int tx, int ty) const {
42     IntRect outerBox(tx + borderLeft() + paddingLeft(),
43                      ty + borderTop() + paddingTop(),
44                      contentWidth(), contentHeight());
45     IntRect innerBox(tx + m_innerBlock->xPos() + m_innerBlock->paddingLeft(),
46                      ty + m_innerBlock->yPos() + m_innerBlock->paddingTop(),
47                      m_innerBlock->contentWidth(),
48                      m_innerBlock->contentHeight());
49     return intersection(outerBox, innerBox);