This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[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)
     {

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]