diff -r 0c253d9aed69 go/expressions.cc
--- a/go/expressions.cc	Fri Nov 16 16:50:52 2012 -0800
+++ b/go/expressions.cc	Sat Nov 17 23:39:55 2012 -0800
@@ -180,24 +180,25 @@
       // Assigning nil to an open array.
       go_assert(TREE_CODE(lhs_type_tree) == RECORD_TYPE);
 
-      VEC(constructor_elt,gc)* init = VEC_alloc(constructor_elt, gc, 3);
+      vec<constructor_elt, va_gc> *init;
+      vec_alloc(init, 3);
 
       constructor_elt empty = {NULL, NULL};
-      constructor_elt* elt = VEC_quick_push(constructor_elt, init, empty);
+      constructor_elt* elt = init->quick_push(empty);
       tree field = TYPE_FIELDS(lhs_type_tree);
       go_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(field)),
 			"__values") == 0);
       elt->index = field;
       elt->value = fold_convert(TREE_TYPE(field), null_pointer_node);
 
-      elt = VEC_quick_push(constructor_elt, init, empty);
+      elt = init->quick_push(empty);
       field = DECL_CHAIN(field);
       go_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(field)),
 			"__count") == 0);
       elt->index = field;
       elt->value = fold_convert(TREE_TYPE(field), integer_zero_node);
 
-      elt = VEC_quick_push(constructor_elt, init, empty);
+      elt = init->quick_push(empty);
       field = DECL_CHAIN(field);
       go_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(field)),
 			"__capacity") == 0);
@@ -320,10 +321,11 @@
 
   // Start building a constructor for the value we will return.
 
-  VEC(constructor_elt,gc)* init = VEC_alloc(constructor_elt, gc, 2);
+  vec<constructor_elt, va_gc> *init;
+  vec_alloc(init, 2);
 
   constructor_elt empty = {NULL, NULL};
-  constructor_elt* elt = VEC_quick_push(constructor_elt, init, empty);
+  constructor_elt* elt = init->quick_push(empty);
   tree field = TYPE_FIELDS(lhs_type_tree);
   go_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(field)),
 		    (lhs_is_empty ? "__type_descriptor" : "__methods")) == 0);
@@ -331,7 +333,7 @@
   elt->value = fold_convert_loc(location.gcc_location(), TREE_TYPE(field),
                                 first_field_value);
 
-  elt = VEC_quick_push(constructor_elt, init, empty);
+  elt = init->quick_push(empty);
   field = DECL_CHAIN(field);
   go_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(field)), "__object") == 0);
   elt->index = field;
@@ -445,10 +447,11 @@
 
   // The result is going to be a two element constructor.
 
-  VEC(constructor_elt,gc)* init = VEC_alloc(constructor_elt, gc, 2);
+  vec<constructor_elt, va_gc> *init;
+  vec_alloc (init, 2);
 
   constructor_elt empty = {NULL, NULL};
-  constructor_elt* elt = VEC_quick_push(constructor_elt, init, empty);
+  constructor_elt* elt = init->quick_push(empty);
   tree field = TYPE_FIELDS(lhs_type_tree);
   elt->index = field;
 
@@ -511,7 +514,7 @@
 
   // The second field is simply the object pointer.
 
-  elt = VEC_quick_push(constructor_elt, init, empty);
+  elt = init->quick_push(empty);
   field = DECL_CHAIN(field);
   go_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(field)), "__object") == 0);
   elt->index = field;
@@ -10016,23 +10019,24 @@
   tree struct_tree = type_to_tree(this->type()->get_backend(gogo));
   go_assert(TREE_CODE(struct_tree) == RECORD_TYPE);
 
-  VEC(constructor_elt,gc)* init = VEC_alloc(constructor_elt, gc, 3);
+  vec<constructor_elt, va_gc> *init;
+  vec_alloc (init, 3);
 
   constructor_elt empty = {NULL, NULL};
-  constructor_elt* elt = VEC_quick_push(constructor_elt, init, empty);
+  constructor_elt* elt = init->quick_push(empty);
   tree field = TYPE_FIELDS(struct_tree);
   go_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(field)), "__values") == 0);
   elt->index = field;
   elt->value = value_pointer;
 
-  elt = VEC_quick_push(constructor_elt, init, empty);
+  elt = init->quick_push(empty);
   field = DECL_CHAIN(field);
   go_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(field)), "__count") == 0);
   elt->index = field;
   elt->value = fold_convert_loc(loc.gcc_location(), TREE_TYPE(field),
                                 result_length_tree);
 
-  elt = VEC_quick_push(constructor_elt, init, empty);
+  elt = init->quick_push(empty);
   field = DECL_CHAIN(field);
   go_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(field)), "__capacity") == 0);
   elt->index = field;
@@ -11385,8 +11389,8 @@
 
   bool is_constant = true;
   const Struct_field_list* fields = this->type_->struct_type()->fields();
-  VEC(constructor_elt,gc)* elts = VEC_alloc(constructor_elt, gc,
-					    fields->size());
+  vec<constructor_elt, va_gc> *elts;
+  vec_alloc (elts, fields->size());
   Struct_field_list::const_iterator pf = fields->begin();
   Expression_list::const_iterator pv = this->vals_->begin();
   for (tree field = TYPE_FIELDS(type_tree);
@@ -11418,7 +11422,7 @@
 	return error_mark_node;
 
       constructor_elt empty = {NULL, NULL};
-      constructor_elt* elt = VEC_quick_push(constructor_elt, elts, empty);
+      constructor_elt* elt = elts->quick_push(empty);
       elt->index = field;
       elt->value = val;
       if (!TREE_CONSTANT(val))
@@ -11628,10 +11632,8 @@
 Array_construction_expression::get_constructor_tree(Translate_context* context,
 						    tree type_tree)
 {
-  VEC(constructor_elt,gc)* values = VEC_alloc(constructor_elt, gc,
-					      (this->vals_ == NULL
-					       ? 0
-					       : this->vals_->size()));
+  vec<constructor_elt, va_gc> *values;
+  vec_alloc (values, (this->vals_ == NULL ? 0 : this->vals_->size()));
   Type* element_type = this->type_->array_type()->element_type();
   bool is_constant = true;
   if (this->vals_ != NULL)
@@ -11647,7 +11649,7 @@
 	  if (this->indexes_ != NULL)
 	    go_assert(pi != this->indexes_->end());
 	  constructor_elt empty = {NULL, NULL};
-	  constructor_elt* elt = VEC_quick_push(constructor_elt, values, empty);
+	  constructor_elt* elt = values->quick_push(empty);
 
 	  if (this->indexes_ == NULL)
 	    elt->index = size_int(i);
@@ -11856,9 +11858,10 @@
 					       build_index_type(max));
       if (constructor_type == error_mark_node)
 	return error_mark_node;
-      VEC(constructor_elt,gc)* vec = VEC_alloc(constructor_elt, gc, 1);
+      vec<constructor_elt, va_gc> *vec;
+      vec_alloc(vec, 1);
       constructor_elt empty = {NULL, NULL};
-      constructor_elt* elt = VEC_quick_push(constructor_elt, vec, empty);
+      constructor_elt* elt = vec->quick_push(empty);
       elt->index = size_int(0);
       Gogo* gogo = context->gogo();
       Btype* btype = element_type->get_backend(gogo);
@@ -11949,22 +11952,23 @@
     return error_mark_node;
   go_assert(TREE_CODE(type_tree) == RECORD_TYPE);
 
-  VEC(constructor_elt,gc)* init = VEC_alloc(constructor_elt, gc, 3);
+  vec<constructor_elt, va_gc> *init;
+  vec_alloc(init, 3);
 
   constructor_elt empty = {NULL, NULL};
-  constructor_elt* elt = VEC_quick_push(constructor_elt, init, empty);
+  constructor_elt* elt = init->quick_push(empty);
   tree field = TYPE_FIELDS(type_tree);
   go_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(field)), "__values") == 0);
   elt->index = field;
   elt->value = fold_convert(TREE_TYPE(field), space);
 
-  elt = VEC_quick_push(constructor_elt, init, empty);
+  elt = init->quick_push(empty);
   field = DECL_CHAIN(field);
   go_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(field)), "__count") == 0);
   elt->index = field;
   elt->value = fold_convert(TREE_TYPE(field), length_tree);
 
-  elt = VEC_quick_push(constructor_elt, init, empty);
+  elt = init->quick_push(empty);
   field = DECL_CHAIN(field);
   go_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(field)),"__capacity") == 0);
   elt->index = field;
@@ -12157,8 +12161,8 @@
     }
   else
     {
-      VEC(constructor_elt,gc)* values = VEC_alloc(constructor_elt, gc,
-						  this->vals_->size() / 2);
+      vec<constructor_elt, va_gc> *values;
+      vec_alloc(values, this->vals_->size() / 2);
 
       for (Expression_list::const_iterator pv = this->vals_->begin();
 	   pv != this->vals_->end();
@@ -12166,10 +12170,11 @@
 	{
 	  bool one_is_constant = true;
 
-	  VEC(constructor_elt,gc)* one = VEC_alloc(constructor_elt, gc, 2);
+	  vec<constructor_elt, va_gc> *one;
+	  vec_alloc(one, 2);
 
 	  constructor_elt empty = {NULL, NULL};
-	  constructor_elt* elt = VEC_quick_push(constructor_elt, one, empty);
+	  constructor_elt* elt = one->quick_push(empty);
 	  elt->index = key_field;
 	  tree val_tree = (*pv)->get_tree(context);
 	  elt->value = Expression::convert_for_assignment(context, key_type,
@@ -12182,7 +12187,7 @@
 
 	  ++pv;
 
-	  elt = VEC_quick_push(constructor_elt, one, empty);
+	  elt = one->quick_push(empty);
 	  elt->index = val_field;
 	  val_tree = (*pv)->get_tree(context);
 	  elt->value = Expression::convert_for_assignment(context, val_type,
@@ -12193,7 +12198,7 @@
 	  if (!TREE_CONSTANT(elt->value))
 	    one_is_constant = false;
 
-	  elt = VEC_quick_push(constructor_elt, values, empty);
+	  elt = values->quick_push(empty);
 	  elt->index = size_int(i);
 	  elt->value = build_constructor(struct_type, one);
 	  if (one_is_constant)
diff -r 0c253d9aed69 go/gogo-tree.cc
--- a/go/gogo-tree.cc	Fri Nov 16 16:50:52 2012 -0800
+++ b/go/gogo-tree.cc	Sat Nov 17 23:39:55 2012 -0800
@@ -344,18 +344,19 @@
 
   // Build an initialier for the __roots array.
 
-  VEC(constructor_elt,gc)* roots_init = VEC_alloc(constructor_elt, gc,
-						  count + 1);
+  vec<constructor_elt, va_gc> *roots_init;
+  vec_alloc(roots_init, count + 1);
 
   size_t i = 0;
   for (std::vector<Named_object*>::const_iterator p = var_gc.begin();
        p != var_gc.end();
        ++p, ++i)
     {
-      VEC(constructor_elt,gc)* init = VEC_alloc(constructor_elt, gc, 2);
+      vec<constructor_elt, va_gc> *init;
+      vec_alloc(init, 2);
 
       constructor_elt empty = {NULL, NULL};
-      constructor_elt* elt = VEC_quick_push(constructor_elt, init, empty);
+      constructor_elt* elt = init->quick_push(empty);
       tree field = TYPE_FIELDS(root_type);
       elt->index = field;
       Bvariable* bvar = (*p)->get_backend_variable(this, NULL);
@@ -363,45 +364,47 @@
       go_assert(TREE_CODE(decl) == VAR_DECL);
       elt->value = build_fold_addr_expr(decl);
 
-      elt = VEC_quick_push(constructor_elt, init, empty);
+      elt = init->quick_push(empty);
       field = DECL_CHAIN(field);
       elt->index = field;
       elt->value = DECL_SIZE_UNIT(decl);
 
-      elt = VEC_quick_push(constructor_elt, roots_init, empty);
+      elt = roots_init->quick_push(empty);
       elt->index = size_int(i);
       elt->value = build_constructor(root_type, init);
     }
 
   // The list ends with a NULL entry.
 
-  VEC(constructor_elt,gc)* init = VEC_alloc(constructor_elt, gc, 2);
+  vec<constructor_elt, va_gc> *init;
+  vec_alloc(init, 2);
 
   constructor_elt empty = {NULL, NULL};
-  constructor_elt* elt = VEC_quick_push(constructor_elt, init, empty);
+  constructor_elt* elt = init->quick_push(empty);
   tree field = TYPE_FIELDS(root_type);
   elt->index = field;
   elt->value = fold_convert(TREE_TYPE(field), null_pointer_node);
 
-  elt = VEC_quick_push(constructor_elt, init, empty);
+  elt = init->quick_push(empty);
   field = DECL_CHAIN(field);
   elt->index = field;
   elt->value = size_zero_node;
 
-  elt = VEC_quick_push(constructor_elt, roots_init, empty);
+  elt = roots_init->quick_push(empty);
   elt->index = size_int(i);
   elt->value = build_constructor(root_type, init);
 
   // Build a constructor for the struct.
 
-  VEC(constructor_elt,gc)* root_list_init = VEC_alloc(constructor_elt, gc, 2);
+  vec<constructor_elt, va_gc> *root_list_init;
+  vec_alloc(root_list_init, 2);
 
-  elt = VEC_quick_push(constructor_elt, root_list_init, empty);
+  elt = root_list_init->quick_push(empty);
   field = TYPE_FIELDS(root_list_type);
   elt->index = field;
   elt->value = fold_convert(TREE_TYPE(field), null_pointer_node);
 
-  elt = VEC_quick_push(constructor_elt, root_list_init, empty);
+  elt = root_list_init->quick_push(empty);
   field = DECL_CHAIN(field);
   elt->index = field;
   elt->value = build_constructor(array_type, roots_init);
@@ -2030,10 +2033,11 @@
 {
   tree string_type = type_to_tree(Type::make_string_type()->get_backend(this));
 
-  VEC(constructor_elt, gc)* init = VEC_alloc(constructor_elt, gc, 2);
+  vec<constructor_elt, va_gc> *init;
+  vec_alloc(init, 2);
 
   constructor_elt empty = {NULL, NULL};
-  constructor_elt* elt = VEC_quick_push(constructor_elt, init, empty);
+  constructor_elt* elt = init->quick_push(empty);
   tree field = TYPE_FIELDS(string_type);
   go_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(field)), "__data") == 0);
   elt->index = field;
@@ -2041,7 +2045,7 @@
   elt->value = fold_convert(TREE_TYPE(field),
 			    build_fold_addr_expr(str));
 
-  elt = VEC_quick_push(constructor_elt, init, empty);
+  elt = init->quick_push(empty);
   field = DECL_CHAIN(field);
   go_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(field)), "__length") == 0);
   elt->index = field;
@@ -2089,12 +2093,13 @@
 {
   go_assert(TREE_CODE(slice_type_tree) == RECORD_TYPE);
 
-  VEC(constructor_elt,gc)* init = VEC_alloc(constructor_elt, gc, 3);
+  vec<constructor_elt, va_gc> *init;
+  vec_alloc(init, 3);
 
   tree field = TYPE_FIELDS(slice_type_tree);
   go_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(field)), "__values") == 0);
   constructor_elt empty = {NULL, NULL};
-  constructor_elt* elt = VEC_quick_push(constructor_elt, init, empty);
+  constructor_elt* elt = init->quick_push(empty);
   elt->index = field;
   go_assert(TYPE_MAIN_VARIANT(TREE_TYPE(field))
 	     == TYPE_MAIN_VARIANT(TREE_TYPE(values)));
@@ -2109,13 +2114,13 @@
 
   field = DECL_CHAIN(field);
   go_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(field)), "__count") == 0);
-  elt = VEC_quick_push(constructor_elt, init, empty);
+  elt = init->quick_push(empty);
   elt->index = field;
   elt->value = fold_convert(TREE_TYPE(field), count);
 
   field = DECL_CHAIN(field);
   go_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(field)), "__capacity") == 0);
-  elt = VEC_quick_push(constructor_elt, init, empty);
+  elt = init->quick_push(empty);
   elt->index = field;
   elt->value = fold_convert(TREE_TYPE(field), capacity);
 
@@ -2172,12 +2177,12 @@
     }
 
   size_t count = interface_methods->size();
-  VEC(constructor_elt, gc)* pointers = VEC_alloc(constructor_elt, gc,
-						 count + 1);
+  vec<constructor_elt, va_gc> *pointers;
+  vec_alloc(pointers, count + 1);
 
   // The first element is the type descriptor.
   constructor_elt empty = {NULL, NULL};
-  constructor_elt* elt = VEC_quick_push(constructor_elt, pointers, empty);
+  constructor_elt* elt = pointers->quick_push(empty);
   elt->index = size_zero_node;
   Type* td_type;
   if (!is_pointer)
@@ -2218,7 +2223,7 @@
 	go_unreachable();
       fndecl = build_fold_addr_expr(fndecl);
 
-      elt = VEC_quick_push(constructor_elt, pointers, empty);
+      elt = pointers->quick_push(empty);
       elt->index = size_int(i);
       elt->value = fold_convert(const_ptr_type_node, fndecl);
     }
