Fixed compiler asserting when returning a string literal (bug 3836, r+a12=fyren).

This commit is contained in:
David Anderson 2009-05-30 19:43:02 -04:00
parent ef255c9a3e
commit 1efea1fd82

View File

@ -6362,6 +6362,11 @@ static void doreturn(void)
error(78); /* mix "return;" and "return value;" */
ident=doexpr(TRUE,FALSE,TRUE,FALSE,&tag,&sym,TRUE);
needtoken(tTERM);
if (ident==iARRAY && sym==NULL) {
/* returning a literal string is not supported (it must be a variable) */
error(39);
ident=iCONSTEXPR; /* avoid handling an "array" case */
} /* if */
/* see if this function already has a sub type (an array attached) */
sub=finddepend(curfunc);
assert(sub==NULL || sub->ident==iREFARRAY);