diff --git a/source/compiler/tests/warning_247_ovl.meta b/source/compiler/tests/warning_247_ovl.meta new file mode 100644 index 0000000..f36c725 --- /dev/null +++ b/source/compiler/tests/warning_247_ovl.meta @@ -0,0 +1,5 @@ +{ + 'test_type': 'output_check', + 'errors': """ +""" +} diff --git a/source/compiler/tests/warning_247_ovl.pwn b/source/compiler/tests/warning_247_ovl.pwn new file mode 100644 index 0000000..8639051 --- /dev/null +++ b/source/compiler/tests/warning_247_ovl.pwn @@ -0,0 +1,36 @@ +// This test makes sure overloaded operators for tag `bool:` don't trigger +// warning 247. The code in 'main()' is copied from file "warning_247.pwn", +// but with the lines that test operators `<<`, `>>`, `>>>` and `~` removed, +// as shift operators can't be overloaded and `~` is reserved for destructors. + +bool:operator -(bool:oper) return oper; +bool:operator ++(bool:oper) return oper; +bool:operator --(bool:oper) return oper; +bool:operator *(bool:oper1, bool:oper2) return oper1,oper2; +bool:operator /(bool:oper1, bool:oper2) return oper1,oper2; +bool:operator %(bool:oper1, bool:oper2) return oper1,oper2; +bool:operator +(bool:oper1, bool:oper2) return oper1,oper2; +bool:operator -(bool:oper1, bool:oper2) return oper1,oper2; +bool:operator <=(bool:oper1, bool:oper2) return oper1,oper2; +bool:operator >=(bool:oper1, bool:oper2) return oper1,oper2; +bool:operator <(bool:oper1, bool:oper2) return oper1,oper2; +bool:operator >(bool:oper1, bool:oper2) return oper1,oper2; + +main() +{ + new bool:a = true, bool:b = false; + if (a <= b) {} + if (a >= b) {} + if (a < b) {} + if (a > b) {} + if (-a) {} + if (++a) {} + if (a++) {} + if (--a) {} + if (a--) {} + if (a * b) {} + if (a / b) {} + if (a % b) {} + if (a + b) {} + if (a - b) {} +}