summaryrefslogtreecommitdiff
path: root/gcc/go/gofrontend/parse.cc
diff options
context:
space:
mode:
authorbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2016-04-17 06:42:12 +0000
committerbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2016-04-17 06:42:12 +0000
commitbd356bb6d247b18723734d4d1d0b32191cfb1a9a (patch)
tree1882cabb94561f964beaa242d722700c4239ab25 /gcc/go/gofrontend/parse.cc
parentc8aed844acdc89884d630c7e3266ecd8d4101847 (diff)
downloadgcc-bd356bb6d247b18723734d4d1d0b32191cfb1a9a.tar.gz
2016-04-17 Basile Starynkevitch <basile@starynkevitch.net>
{{merging with even more of GCC 6, using subversion 1.9 svn merge -r232606:233050 ^/trunk }} [gcc/] 2016-04-17 Basile Starynkevitch <basile@starynkevitch.net> * melt/libmelt-ana-gimple.melt: (gimple_transaction): Use gimple_transaction_label_norm. Not sure that (gccif "6." ...) does what it should... git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@235078 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/go/gofrontend/parse.cc')
-rw-r--r--gcc/go/gofrontend/parse.cc17
1 files changed, 11 insertions, 6 deletions
diff --git a/gcc/go/gofrontend/parse.cc b/gcc/go/gofrontend/parse.cc
index 9d6a8c6f4a6..827eb0a120a 100644
--- a/gcc/go/gofrontend/parse.cc
+++ b/gcc/go/gofrontend/parse.cc
@@ -419,6 +419,8 @@ Parse::array_type(bool may_use_ellipsis)
}
Type* element_type = this->type();
+ if (element_type->is_error_type())
+ return Type::make_error_type();
return Type::make_array_type(element_type, length);
}
@@ -2737,7 +2739,7 @@ Parse::composite_lit(Type* type, int depth, Location location)
// This must be a composite literal inside another composite
// literal, with the type omitted for the inner one.
val = this->composite_lit(type, depth + 1, token->location());
- is_type_omitted = true;
+ is_type_omitted = true;
}
token = this->peek_token();
@@ -2749,11 +2751,14 @@ Parse::composite_lit(Type* type, int depth, Location location)
}
else
{
- if (is_type_omitted && !val->is_error_expression())
- {
- error_at(this->location(), "unexpected %<:%>");
- val = Expression::make_error(this->location());
- }
+ if (is_type_omitted)
+ {
+ // VAL is a nested composite literal with an omitted type being
+ // used a key. Record this information in VAL so that the correct
+ // type is associated with the literal value if VAL is a
+ // map literal.
+ val->complit()->update_key_path(depth);
+ }
this->advance_token();