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

This commit is contained in:
David Anderson 2009-05-30 20:03:56 -04:00
parent c4b17855e5
commit 752bd78de5

View File

@ -6371,6 +6371,11 @@ static void doreturn(void)
error(78); /* mix "return;" and "return value;" */ error(78); /* mix "return;" and "return value;" */
ident=doexpr(TRUE,FALSE,TRUE,FALSE,&tag,&sym,TRUE); ident=doexpr(TRUE,FALSE,TRUE,FALSE,&tag,&sym,TRUE);
needtoken(tTERM); 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) */ /* see if this function already has a sub type (an array attached) */
sub=finddepend(curfunc); sub=finddepend(curfunc);
assert(sub==NULL || sub->ident==iREFARRAY); assert(sub==NULL || sub->ident==iREFARRAY);