1 /* { dg-do compile } */
2 
3 struct VectorD2
4 {
VectorD2VectorD25   VectorD2() : x(0), y(0) { }
VectorD2VectorD26   VectorD2(int _x, int _y) : x(_x), y(_y) { }
7   int x, y;
GetLength2VectorD28   int GetLength2() const { return x*x + y*y; };
9   VectorD2 operator+(const VectorD2 vec) const {
10       return VectorD2(x+vec.x,y+vec.y);
11   }
12 };
13 struct Shape
14 {
15   enum Type { ST_RECT, ST_CIRCLE } type;
16   VectorD2 pos;
17   VectorD2 radius;
18   bool CollisionWith(const Shape& s) const;
19 };
CollisionWith(const Shape & s)20 bool Shape::CollisionWith(const Shape& s) const
21 {
22   if(type == ST_CIRCLE && s.type == ST_RECT)
23     return s.CollisionWith(*this);
24   return (pos + s.pos).GetLength2() < (radius + s.radius).GetLength2();
25 }
26