diff mbox

Go patch committed: Avoid crash with extra struct initializer

Message ID mcrsjwpa0q1.fsf@google.com
State New
Headers show

Commit Message

Ian Lance Taylor Jan. 19, 2011, 6:04 a.m. UTC
This patch to the Go frontend avoids a crash when there are extra values
for a struct initializer and the values types remain abstract.
Bootstrapped and tested on x86_64-unknown-linux-gnu.  Committed to
mainline.

Ian
diff mbox

Patch

diff -r b701c2857f59 go/expressions.cc
--- a/go/expressions.cc	Tue Jan 18 21:48:37 2011 -0800
+++ b/go/expressions.cc	Tue Jan 18 22:01:01 2011 -0800
@@ -10609,6 +10609,10 @@ 
 	  (*pv)->determine_type(&subcontext);
 	}
     }
+  // Extra values are an error we will report elsewhere; we still want
+  // to determine the type to avoid knockon errors.
+  for (; pv != this->vals_->end(); ++pv)
+    (*pv)->determine_type_no_context();
 }
 
 // Check types.