Compiler: Fix asserting when returning a string literal.

Imported from SM: https://bugs.alliedmods.net/show_bug.cgi?id=3836.
This commit is contained in:
Arkshine 2014-08-13 18:22:06 +02:00
parent 57b172072a
commit 9b5c6bfff0

View File

@ -5251,6 +5251,11 @@ static void doreturn(void)
error(78); /* mix "return;" and "return value;" */
ident=doexpr(TRUE,FALSE,TRUE,TRUE,&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);