return TRAVERSE_CONTINUE;
if (func->block()->may_fall_through())
- error_at(func->location(), "control reaches end of non-void function");
+ error_at(func->block()->end_location(),
+ "missing return at end of function");
return TRAVERSE_CONTINUE;
}
bool
Type_case_clauses::Type_case_clause::may_fall_through() const
{
+ if (this->is_fallthrough_)
+ {
+ // This case means that we automatically fall through to the
+ // next case (it's used for T1 in case T1, T2:). It does not
+ // mean that we fall through to the end of the type switch as a
+ // whole. There is sure to be a next case and that next case
+ // will determine whether we fall through to the statements
+ // after the type switch.
+ return false;
+ }
if (this->statements_ == NULL)
return true;
return this->statements_->may_fall_through();