This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[gccgo] Error on ... mismatch
- From: Ian Lance Taylor <iant at google dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 05 Feb 2010 21:36:38 -0800
- Subject: [gccgo] Error on ... mismatch
This is probably temporary, but for now the Go compilers give an error
passing a ... parameter to a function which expects ...T, and
vice-versa. Probably the ... without T style will be removed.
Anyhow, I committed this patch to the gccgo branch for now.
Ian
diff -r 2de2cff5a31d go/expressions.cc
--- a/go/expressions.cc Fri Feb 05 18:48:57 2010 -0800
+++ b/go/expressions.cc Fri Feb 05 21:34:05 2010 -0800
@@ -6338,7 +6338,10 @@
{
// The argument is ... with no type. We only match if the
// parameter is too.
- return param_type->interface_type() != NULL;
+ if (param_type->interface_type() != NULL)
+ return true;
+ error_at(arg->location(), "... mismatch: passing ... as ...T");
+ return false;
}
else
{
@@ -6347,9 +6350,12 @@
Array_type* var_at = var_type->array_type();
gcc_assert(var_at != NULL);
Array_type* param_at = param_type->array_type();
- return (param_at != NULL
- && Type::are_identical(var_at->element_type(),
- param_at->element_type()));
+ if (param_at != NULL
+ && Type::are_identical(var_at->element_type(),
+ param_at->element_type()))
+ return true;
+ error_at(arg->location(), "... mismatch: passing ...T as ...");
+ return false;
}
}