aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.brendan/template9.C
blob: c4c9c831157286e5422c918cb7e482b431f2c8a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// GROUPS passed templates
// Test that the compiler will emit the definition of min given just
// the declaration.  At one point in the past, it did not.
// Special g++ Options: -fguiding-decls
#include <iostream.h>

template <class T> inline T min(T a, T b) { return (a < b) ? a : b;};

double min(double,double);	// this should expand the template

main () {
    int a = 1, b = 2;
    double aa = 2.0, bb = 1.2;
    cout << min(a,b) << ", " << min(aa,bb) << "\n";
    if (min (a, aa) == a)
      cout << "PASS" << endl;
    else
      cout << "FAIL" << endl;
}