Merge pull request #312 from YashasSamaga/fix-i308

fix result propagation in constexpr operator chains
This commit is contained in:
Barnaby Keene 2018-07-27 10:03:53 +01:00 committed by GitHub
commit da9d65057a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 0 deletions

View File

@ -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;

View File

@ -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\\\"

View File

@ -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 () {
}