trigger destructor not implemented error
``` #include <a_samp> forward operator~(Error:right[], size); main() { new Error:e; } ``` ``` CODE 0 ; 0 ;program exit point halt 0 proc ; main ; line 4 ; line 5 break ; c ;$lcl e fffffffc push.c 0 ;$exp push.pri push.c 1 addr.pri fffffffc push.pri push.c 8 call .~4000000f ; operator~(Error:) pop.pri stack 4 zero.pri retn STKSIZE 1000 ``` The compiler tries to call a non-existent function. This commit instead throws "function not implemented" error when destructor definition is missing.
This commit is contained in:
parent
da9d65057a
commit
ce17cff7f7
@ -4967,6 +4967,14 @@ static void destructsymbols(symbol *root,int level)
|
||||
/* check that the '~' operator is defined for this tag */
|
||||
operator_symname(symbolname,"~",sym->tag,0,1,0);
|
||||
if ((opsym=findglb(symbolname,sGLOBAL))!=NULL) {
|
||||
if ((opsym->usage & uMISSING)!=0 || (opsym->usage & uPROTOTYPED)==0) {
|
||||
char symname[2*sNAMEMAX+16]; /* allow space for user defined operators */
|
||||
funcdisplayname(symname,opsym->name);
|
||||
if ((opsym->usage & uMISSING)!=0)
|
||||
error(4,symname); /* function not defined */
|
||||
if ((opsym->usage & uPROTOTYPED)==0)
|
||||
error(71,symname); /* operator must be declared before use */
|
||||
} /* if */
|
||||
/* save PRI, in case of a return statment */
|
||||
if (!savepri) {
|
||||
pushreg(sPRI); /* right-hand operand is in PRI */
|
||||
|
Loading…
x
Reference in New Issue
Block a user