Commit d5f3d14a by Ian Lance Taylor

Don't crash on redefined variable.

From-SVN: r170029
parent 8629c998
......@@ -1848,7 +1848,13 @@ Parse::init_var(const Typed_identifier& tid, Type* type, Expression* init,
*is_new = true;
Variable* var = new Variable(type, init, this->gogo_->in_global_scope(),
false, false, location);
return this->gogo_->add_variable(tid.name(), var);
Named_object* no = this->gogo_->add_variable(tid.name(), var);
if (!no->is_variable())
{
// The name is already defined, so we just gave an error.
return this->gogo_->add_sink();
}
return no;
}
// Create a dummy global variable to force an initializer to be run in
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment