From 1efea1fd82605e42000276d5f89cfc80828d3045 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Sat, 30 May 2009 19:43:02 -0400 Subject: [PATCH] Fixed compiler asserting when returning a string literal (bug 3836, r+a12=fyren). --- sourcepawn/compiler/sc1.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sourcepawn/compiler/sc1.c b/sourcepawn/compiler/sc1.c index 28c6606d..1a99d06c 100644 --- a/sourcepawn/compiler/sc1.c +++ b/sourcepawn/compiler/sc1.c @@ -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);