]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
PR go/61264
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 16 Dec 2014 19:14:54 +0000 (19:14 +0000)
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 16 Dec 2014 19:14:54 +0000 (19:14 +0000)
compiler: Fix copying behavior for empty composite literals.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@218789 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/go/gofrontend/expressions.cc

index f6d43811e161261b0becc59100614a93b359054a..9f68f77dc47d706e25f1a0199681e0ff69c650a4 100644 (file)
@@ -11588,7 +11588,10 @@ class Struct_construction_expression : public Expression
   do_copy()
   {
     Struct_construction_expression* ret =
-      new Struct_construction_expression(this->type_, this->vals_->copy(),
+      new Struct_construction_expression(this->type_,
+                                        (this->vals_ == NULL
+                                         ? NULL
+                                         : this->vals_->copy()),
                                         this->location());
     if (this->traverse_order_ != NULL)
       ret->set_traverse_order(this->traverse_order_);
@@ -12353,7 +12356,10 @@ class Map_construction_expression : public Expression
   Expression*
   do_copy()
   {
-    return new Map_construction_expression(this->type_, this->vals_->copy(),
+    return new Map_construction_expression(this->type_,
+                                          (this->vals_ == NULL
+                                           ? NULL
+                                           : this->vals_->copy()),
                                           this->location());
   }