diff options
Diffstat (limited to 'src/cmd/gc/dcl.c')
-rw-r--r-- | src/cmd/gc/dcl.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/cmd/gc/dcl.c b/src/cmd/gc/dcl.c index 338a6213a..e17ccfb22 100644 --- a/src/cmd/gc/dcl.c +++ b/src/cmd/gc/dcl.c @@ -961,7 +961,7 @@ findtype(NodeList *l) } NodeList* -checkarglist(NodeList *all) +checkarglist(NodeList *all, int input) { int named; Node *n, *t, *nextt; @@ -1015,8 +1015,12 @@ checkarglist(NodeList *all) if(n != N) n = newname(n->sym); n = nod(ODCLFIELD, n, t); - if(l->next != nil && n->right != N && n->right->op == OTYPE && isddd(n->right->type)) - yyerror("only last argument can have type ..."); + if(n->right != N && n->right->op == OTYPE && isddd(n->right->type)) { + if(!input) + yyerror("cannot use ... in output argument list"); + else if(l->next != nil) + yyerror("can only use ... as final argument in list"); + } l->n = n; } return all; |