This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[gccgo] Only use numeric context type for const reference
- From: Ian Lance Taylor <iant at google dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sun, 31 Jan 2010 00:05:28 -0800
- Subject: [gccgo] Only use numeric context type for const reference
When using the contextual type for a const reference, we should only
use a numeric type. We don't want to treat a constant as an interface
type. Committed to gccgo branch.
Ian
diff -r ee4245ad9555 go/expressions.cc
--- a/go/expressions.cc Sat Jan 30 23:50:36 2010 -0800
+++ b/go/expressions.cc Sat Jan 30 23:56:02 2010 -0800
@@ -2096,7 +2096,9 @@
Type* ctype = this->constant_->const_value()->type();
if (ctype != NULL && !ctype->is_abstract())
;
- else if (context->type != NULL)
+ else if (context->type != NULL
+ && (context->type->integer_type() != NULL
+ || context->type->float_type() != NULL))
this->type_ = context->type;
else if (!context->may_be_abstract)
{