From bug-octave-request at bevo dot che dot wisc dot edu Thu Jul 30 00:45:28 1998 Subject: tiny patches for 2.0.13 From: Mumit Khan To: bug-octave at bevo dot che dot wisc dot edu Date: Thu, 30 Jul 1998 00:45:29 -0500 (CDT) There are two patches here -- 1. fix default template args. Can't have non-default args after default ones. Note that in the case tree_multi_val_ret, there's no way to supply a default arg for 3rd parameter without incurring ambiguity. 2. fix template instantiations. I believe that most of the new'ish compilers now implement this, but can't verify from the CD2 wording (I don't have access to the committee draft). Here's an example: template void foo () { } template void foo (int); // this one gets picked, template void foo (const int&); // but not this. int main () { int i = 1; foo (i); const int& j = i; foo (j); return 0; } btw, this is with an egcs-1.1 pre-release. The first problem should not have compiled with egcs-1.0.x either, so I'm a bit surprised ... Sat Jul 11 00:39:28 1998 Mumit Khan * pt-exp.h (tree_boolean_expression::tree_boolean_expression): Supply default argument. * pt-mvr-base.h (tree_multi_val_ret::tree_multi_var_ret): Don't use default arguments for parameters. * xdiv.cc (mx_leftdiv_conform, mx_div_conform): Instantiate correct templates. --- pt-exp.h.~1 Sat Jul 11 00:07:53 1998 +++ pt-exp.h Sat Jul 11 00:08:04 1998 at @ -253,7 +253,7 @@ public: or }; - tree_boolean_expression (int l = -1, int c = -1, type t) + tree_boolean_expression (int l = -1, int c = -1, type t = unknown) : tree_binary_expression (l, c), etype (t) { } tree_boolean_expression (tree_expression *a, tree_expression *b, --- pt-mvr-base.h.~1 Sat Jul 11 00:10:50 1998 +++ pt-mvr-base.h Sat Jul 11 00:15:49 1998 at @ -41,7 +41,7 @@ public: tree_multi_val_ret (int l = -1, int c = -1) : tree_expression (l, c) { } - tree_multi_val_ret (int l = -1, int c = -1, tree_expression::type et) + tree_multi_val_ret (int l, int c, tree_expression::type et) : tree_expression (l, c, et) { } ~tree_multi_val_ret (void) { } --- xdiv.cc.~1 Sat Jul 11 00:31:26 1998 +++ xdiv.cc Sat Jul 11 00:35:02 1998 at @ -70,10 +70,10 @@ mx_leftdiv_conform (T1 a, T2 b) return true; } -template bool mx_leftdiv_conform (const Matrix&, const Matrix&); -template bool mx_leftdiv_conform (const Matrix&, const ComplexMatrix&); -template bool mx_leftdiv_conform (const ComplexMatrix&, const ComplexMatrix&); -template bool mx_leftdiv_conform (const ComplexMatrix&, const Matrix&); +template bool mx_leftdiv_conform (Matrix, Matrix); +template bool mx_leftdiv_conform (Matrix, ComplexMatrix); +template bool mx_leftdiv_conform (ComplexMatrix, ComplexMatrix); +template bool mx_leftdiv_conform (ComplexMatrix, Matrix); template bool at @ -94,10 +94,10 @@ mx_div_conform (T1 a, T2 b) return true; } -template bool mx_div_conform (const Matrix&, const Matrix&); -template bool mx_div_conform (const Matrix&, const ComplexMatrix&); -template bool mx_div_conform (const ComplexMatrix&, const ComplexMatrix&); -template bool mx_div_conform (const ComplexMatrix&, const Matrix&); +template bool mx_div_conform (Matrix, Matrix); +template bool mx_div_conform (Matrix, ComplexMatrix); +template bool mx_div_conform (ComplexMatrix, ComplexMatrix); +template bool mx_div_conform (ComplexMatrix, Matrix); // Right division functions. //