Merge pull request #311 from YashasSamaga/fix-i310

destructor not implemented error
This commit is contained in:
Barnaby Keene 2018-08-01 12:02:23 +01:00 committed by GitHub
commit 22e14c6ccd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 0 deletions

View File

@ -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 */

View File

@ -70,6 +70,12 @@ set_tests_properties(const_array_args_and_literals_gh_276 PROPERTIES PASS_REGULA
.*\\.pwn\\(41\\) : warning 239: literal array/string passed to a non-const parameter
")
add_compiler_test(destructor_not_impl_gh_310 ${CMAKE_CURRENT_SOURCE_DIR}/destructor_not_impl_gh_310.pwn)
set_tests_properties(destructor_not_impl_gh_310 PROPERTIES PASS_REGULAR_EXPRESSION
".*\\.pwn\\(6\\) : error 004: function \"operator~(Error:)\" is not implemented
")
set_tests_properties(destructor_not_impl_gh_310 PROPERTIES WILL_FAIL TRUE)
# Crashers
#
# These tests simply check that the compiler doesn't crash.

View File

@ -0,0 +1,4 @@
forward operator~(Error:right[], size);
main() {
new Error:e;
}