Fixed compiler asserting when returning a string literal (bug 3836, r=fyren).
authorDavid Anderson <dvander@alliedmods.net>
Sat May 30 20:03:56 2009 -0400 (2009-05-30)
changeset 274063a02d7932b3
parent 2739 f3c28a4c41e4
child 2741 efbe232c5834
Fixed compiler asserting when returning a string literal (bug 3836, r=fyren).
sourcepawn/compiler/sc1.c
     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);