This patch from Chris Manghane fixes a bug when the value in a range
clause is a sink variable. It's fixedbugs/bug454.go in the master Go
testsuite, and will appear in the gccgo testsuite in due course.
Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu.
Committed to mainline and 4.8 branch.
Ian
diff -r 4baad377e84a go/parse.cc
--- a/go/parse.cc Sat Aug 17 10:56:57 2013 -0700
+++ b/go/parse.cc Sat Aug 17 11:02:05 2013 -0700
@@ -5266,7 +5266,8 @@
no->var_value()->set_type_from_range_value();
if (is_new)
any_new = true;
- p_range_clause->value = Expression::make_var_reference(no, location);
+ if (!Gogo::is_sink_name(pti->name()))
+ p_range_clause->value = Expression::make_var_reference(no, location);
}
if (!any_new)