This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Go patch committed: Don't crash on defer of type conversion
- From: Ian Lance Taylor <iant at google dot com>
- To: gcc-patches at gcc dot gnu dot org, gofrontend-dev at googlegroups dot com
- Date: Tue, 15 Feb 2011 11:52:41 -0800
- Subject: Go patch committed: Don't crash on defer of type conversion
Code like "defer T(v)" where T is a type and v is a value is invalid.
However, since this is a type conversion which looks like a function
call, it may not be detected as invalid at parse time. This patch
avoids a crash where such a type conversion is used with defer.
Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu.
Committed to mainline.
Ian
diff -r 31a6b335fc55 go/types.cc
--- a/go/types.cc Tue Feb 15 11:41:00 2011 -0800
+++ b/go/types.cc Tue Feb 15 11:48:40 2011 -0800
@@ -5659,7 +5659,7 @@
{
if (q->name().empty())
{
- if (q->type() == p->type())
+ if (q->type()->forwarded() == p->type()->forwarded())
error_at(p->location(), "interface inheritance loop");
else
{
@@ -5667,7 +5667,8 @@
for (i = from + 1; i < this->methods_->size(); ++i)
{
const Typed_identifier* r = &this->methods_->at(i);
- if (r->name().empty() && r->type() == q->type())
+ if (r->name().empty()
+ && r->type()->forwarded() == q->type()->forwarded())
{
error_at(p->location(),
"inherited interface listed twice");