summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2009-12-03 01:12:02 -0800
committerRuss Cox <rsc@golang.org>2009-12-03 01:12:02 -0800
commit78c64cbc52cebee45bc44ab09f172571514fc83f (patch)
treef4612be11e407e0e7bb3bc14823cc23580515006 /src
parent785c8ab4276110f0aa8d53d704dff04c4d1996f1 (diff)
downloadgolang-78c64cbc52cebee45bc44ab09f172571514fc83f.tar.gz
gc: recursive type error
Fixes issue 245. R=ken2 http://codereview.appspot.com/164094
Diffstat (limited to 'src')
-rw-r--r--src/cmd/gc/align.c3
-rw-r--r--src/cmd/gc/typecheck.c2
2 files changed, 5 insertions, 0 deletions
diff --git a/src/cmd/gc/align.c b/src/cmd/gc/align.c
index b74ac0f29..cf0851646 100644
--- a/src/cmd/gc/align.c
+++ b/src/cmd/gc/align.c
@@ -205,6 +205,9 @@ dowidth(Type *t)
checkwidth(t->down);
break;
case TFORW: // should have been filled in
+ yyerror("invalid recursive type %T", t);
+ w = 1; // anything will do
+ break;
case TANY:
// dummy type; should be replaced before use.
if(!debug['A'])
diff --git a/src/cmd/gc/typecheck.c b/src/cmd/gc/typecheck.c
index 0fd359b31..76147e48f 100644
--- a/src/cmd/gc/typecheck.c
+++ b/src/cmd/gc/typecheck.c
@@ -1039,6 +1039,8 @@ reswitch:
case ODCLTYPE:
ok |= Etop;
typecheck(&n->left, Etype);
+ if(!incannedimport)
+ checkwidth(n->left->type);
goto ret;
}