OSDN Git Service

a5b19e43fa6d4033f77b1be35a394a72550b227c
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.old-deja / g++.pt / t16.C
1 extern "C" void printf (char *, ...);
2 template <class T> T max (const T&x, const T&y)
3 {
4   return (x>y)?x:y;
5 }
6 int min (const float&, const float&);
7 int min (const int& i1, const int& i2) {
8   return (i1 < i2) ? i1 : i2;
9 }
10
11 class complex
12 {
13   double re, im;
14  public:
15   complex (double r, double i=0) { re = r; im = i; }
16   friend int operator > (const complex& x, const complex &y) { return 0; }
17   void print () { }
18 };
19
20 main ()
21 {
22   complex c1 (1, 0);
23   complex c2 (2, 0);
24
25   int j = max (1, 37);
26   complex m1 = max (c1, c2);
27   m1.print ();
28   printf ("j=%d\n", j);
29   return 0;
30 }