2018-11-07 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / g++.dg / torture / pr78224.C
blobbb85339e8f89f5527009c5ba5b068bccea4e2a4d
1 // { dg-do compile }
3 extern "C"{
4   float sqrtf(float);
7 inline float squareroot(const float f)
9   return sqrtf(f);
12 inline int squareroot(const int f)
14   return static_cast<int>(sqrtf(static_cast<float>(f)));
17 template <class T>
18 class vector2d
20 public:
21   vector2d(T nx, T ny) : X(nx), Y(ny) {}
22   T getLength() const { return squareroot( X*X + Y*Y ); }
23   T X;
24   T Y;
27 vector2d<int> getMousePos();
29 class Client
31 public:
32   Client();
33   ~Client();
36 void the_game(float turn_amount)
38   Client client;
39   bool first = true;
41   while (1) {
42       if (first) {
43         first = false;
44       } else {
45         int dx = getMousePos().X;
46         int dy = getMousePos().Y;
48         turn_amount = vector2d<float>(dx, dy).getLength();
49       }
50   }