Merge branch 'dev' into fix-i314

This commit is contained in:
Yashas Samaga B L 2018-08-01 19:12:25 +05:30 committed by GitHub
commit df9f9fe780
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 0 deletions

View File

@ -4971,6 +4971,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

@ -80,6 +80,12 @@ set_tests_properties(md_array_size_chk_gh_314 PROPERTIES PASS_REGULAR_EXPRESSION
")
set_tests_properties(md_array_size_chk_gh_314 PROPERTIES WILL_FAIL TRUE)
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;
}