From 0f2be732d964ef89eb268114e4dd8d00130aa29b Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Thu, 23 Jul 2015 19:57:22 +0000 Subject: compiler: Make empty interface types for vars during parse time. When making the type for a variable with an empty interface type, the parser makes an interface type with a NULL method set and relies on later passes to correct this. For sink variables, which are ignored in later passes, the interface method table is never finalized and a compile time assertion is issued. Instead, the initial type generated by the parser should be the empty interface type. Fixes golang/go#11579. Reviewed-on: https://go-review.googlesource.com/12049 From-SVN: r226123 --- gcc/go/gofrontend/parse.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'gcc/go/gofrontend/parse.cc') diff --git a/gcc/go/gofrontend/parse.cc b/gcc/go/gofrontend/parse.cc index 970e6bd..113371c 100644 --- a/gcc/go/gofrontend/parse.cc +++ b/gcc/go/gofrontend/parse.cc @@ -1225,7 +1225,11 @@ Parse::interface_type(bool record) methods = NULL; } - Interface_type* ret = Type::make_interface_type(methods, location); + Interface_type* ret; + if (methods == NULL) + ret = Type::make_empty_interface_type(location); + else + ret = Type::make_interface_type(methods, location); if (record) this->gogo_->record_interface_type(ret); return ret; -- cgit v1.1