1 // Test -lno-implicit-template instantiation of polymorphic types
2 // This is the same as prop3.pcc except that it is generated with
3 // the options save_space and -O15.
7 datatype List<T> :: collectable printable rewrite
8 = #[] | #[ T ... List<T> ]
11 datatype Tree<T> :: collectable printable rewrite
12 = Empty | Leaf of T | Node of (Tree<T>, Tree<T>)
15 datatype Foo :: collectable printable rewrite = FOO() | BAR();
17 instantiate extern datatype List<int>, Tree<List<int> >, Tree<int>, Foo;
19 Tree<int> flip(Tree<int> t)
21 { Node(a,b): { return Node(flip(b),flip(a)); }
26 #define PROP_EXPLICIT_TEMPLATE_INSTANTIATION
27 instantiate datatype List<int>, Tree<List<int> >, Tree<int>, Foo;
30 { List<int> a = #[1,2,3];
31 Tree<List<int> > empty = Empty; // fake it for now
32 Tree<List<int> > b = Node(Leaf(#[4]),Node(Leaf(#[5,6]),empty));
33 Tree<int> c = Node(Leaf(4),Node(Leaf(5),Leaf(6)));
34 for (int i = 0; i < 10000; i++)
36 cout << "a = " << a << endl;
37 cout << "b = " << b << endl;
38 cout << "c = " << c << endl;