diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2012-02-01 20:40:31 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2012-02-01 20:40:31 +0000 |
commit | fa9fe7a5a74938c73044fdd2ccd735bf0d703773 (patch) | |
tree | 835b8be9bed5f845cf6ff6de6b7ebfb75d619556 /gcc | |
parent | cf82db162618c202eecf4dd8201d3fa2a5cb521b (diff) | |
download | gcc-fa9fe7a5a74938c73044fdd2ccd735bf0d703773.zip gcc-fa9fe7a5a74938c73044fdd2ccd735bf0d703773.tar.gz gcc-fa9fe7a5a74938c73044fdd2ccd735bf0d703773.tar.bz2 |
compiler: Don't crash on switch _ := v.(type).
From-SVN: r183814
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/go/gofrontend/parse.cc | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/gcc/go/gofrontend/parse.cc b/gcc/go/gofrontend/parse.cc index 1359f4c..10abfc0 100644 --- a/gcc/go/gofrontend/parse.cc +++ b/gcc/go/gofrontend/parse.cc @@ -4311,9 +4311,16 @@ Parse::type_switch_body(Label* label, const Type_switch& type_switch, Named_object* switch_no = NULL; if (!type_switch.name.empty()) { - Variable* switch_var = new Variable(NULL, type_switch.expr, false, false, - false, type_switch.location); - switch_no = this->gogo_->add_variable(type_switch.name, switch_var); + if (Gogo::is_sink_name(type_switch.name)) + error_at(type_switch.location, + "no new variables on left side of %<:=%>"); + else + { + Variable* switch_var = new Variable(NULL, type_switch.expr, false, + false, false, + type_switch.location); + switch_no = this->gogo_->add_variable(type_switch.name, switch_var); + } } Type_switch_statement* statement = |