Commit 77aaa355 authored by Russ Cox's avatar Russ Cox

gc: fix import of struct type in struct literal

Fixes #2716.

R=ken2
CC=golang-dev
https://golang.org/cl/5652065
parent 53e139c7
......@@ -987,7 +987,10 @@ lbrace:
new_name:
sym
{
$$ = newname($1);
if($1 == S)
$$ = N;
else
$$ = newname($1);
}
dcl_name:
......@@ -1418,6 +1421,19 @@ structdcl:
{
NodeList *l;
Node *n;
if(l != nil && l->next == nil && l->n == nil) {
// ? symbol, during import
n = $2;
if(n->op == OIND)
n = n->left;
n = embedded(n->sym);
n->right = $2;
n->val = $3;
$$ = list1(n);
break;
}
for(l=$1; l; l=l->next) {
l->n = nod(ODCLFIELD, l->n, $2);
l->n->val = $3;
......
This diff is collapsed.
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
import "./p"
func main() {}
var _ p.A
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package p
type A struct {
s struct{int}
}
func (a *A) f() {
a.s = struct{int}{0}
}
// $G $D/$F.dir/p.go && $G $D/$F.dir/main.go
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Issue 2716. Export metadata error made main.go not compile.
package ignored
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment