diff --git a/source/compiler/sc3.c b/source/compiler/sc3.c index c61a04cd..719d0544 100644 --- a/source/compiler/sc3.c +++ b/source/compiler/sc3.c @@ -512,6 +512,7 @@ static int plnge_rel(int *opstr,int opoff,int (*hier)(value *lval),value *lval) error(212); if (count>0) { relop_prefix(); + lval2.boolresult=lval->boolresult; *lval=lval2; /* copy right hand expression of the previous iteration */ } /* if */ opidx+=opoff; diff --git a/source/compiler/tests/CMakeLists.txt b/source/compiler/tests/CMakeLists.txt index 6da0c000..2cf5a318 100644 --- a/source/compiler/tests/CMakeLists.txt +++ b/source/compiler/tests/CMakeLists.txt @@ -52,6 +52,14 @@ set_tests_properties(meaningless_class_specifiers_gh_172 PROPERTIES PASS_REGULAR .*\\.pwn\\(1 \\-\\- 2\\) : warning 238: meaningless combination of class specifiers \\(const variable arguments\\) ") +add_compiler_test(constexpr_result_prop_gh_308 ${CMAKE_CURRENT_SOURCE_DIR}/constexpr_result_prop_gh_308.pwn) +set_tests_properties(constexpr_result_prop_gh_308 PROPERTIES PASS_REGULAR_EXPRESSION +".*\\.pwn\\(2\\) : warning 237: user warning: \\\"Test passed.\\\" +.*\\.pwn\\(6\\) : warning 237: user warning: \\\"Test passed.\\\" +.*\\.pwn\\(10\\) : warning 237: user warning: \\\"Test passed.\\\" +.*\\.pwn\\(14\\) : warning 237: user warning: \\\"Test passed.\\\" +") + add_compiler_test(const_array_args_and_literals_gh_276 ${CMAKE_CURRENT_SOURCE_DIR}/const_array_args_and_literals_gh_276.pwn) set_tests_properties(const_array_args_and_literals_gh_276 PROPERTIES PASS_REGULAR_EXPRESSION ".*\\.pwn\\(13\\) : warning 214: possibly a \\\"const\\\" array argument was intended: \\\"arr\\\" diff --git a/source/compiler/tests/constexpr_result_prop_gh_308.pwn b/source/compiler/tests/constexpr_result_prop_gh_308.pwn new file mode 100644 index 00000000..0592badc --- /dev/null +++ b/source/compiler/tests/constexpr_result_prop_gh_308.pwn @@ -0,0 +1,19 @@ +#if (30 < 40 < 50) + #warning "Test passed." +#endif + +#if !(30 < 40 < 35) + #warning "Test passed." +#endif + +#if (30 < 40) + #warning "Test passed." +#endif + +#if !(40 < 35) + #warning "Test passed." +#endif + +main () { + +}