Fixed compiler asserting when returning a string literal (bug 3836, r=fyren).
Fixed compiler asserting when returning a string literal (
bug 3836, r=fyren).
1.1 --- a/sourcepawn/compiler/sc1.c Sat May 30 20:03:01 2009 -0400
1.2 +++ b/sourcepawn/compiler/sc1.c Sat May 30 20:03:56 2009 -0400
1.3 @@ -6371,6 +6371,11 @@
1.4 error(78); /* mix "return;" and "return value;" */
1.5 ident=doexpr(TRUE,FALSE,TRUE,FALSE,&tag,&sym,TRUE);
1.6 needtoken(tTERM);
1.7 + if (ident==iARRAY && sym==NULL) {
1.8 + /* returning a literal string is not supported (it must be a variable) */
1.9 + error(39);
1.10 + ident=iCONSTEXPR; /* avoid handling an "array" case */
1.11 + } /* if */
1.12 /* see if this function already has a sub type (an array attached) */
1.13 sub=finddepend(curfunc);
1.14 assert(sub==NULL || sub->ident==iREFARRAY);