diff options
author | da-woods <dw-git@d-woods.co.uk> | 2021-09-03 07:44:37 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-03 08:44:37 +0200 |
commit | c830db8111be7a7eb1753f4c2fa04c4dbbe3ffdc (patch) | |
tree | fa332cd3ebd4123ae0c80b9ee829e63d6fbcc647 /tests/errors | |
parent | ba6eba21e82e34a14bdae4996fd0b9b297c40f72 (diff) | |
download | cython-c830db8111be7a7eb1753f4c2fa04c4dbbe3ffdc.tar.gz |
Fix C++ bool coercion where no "operator bool" exists (GH-4349)
This was causing c++ classes in if-statements to crash.
Fixes #4348
Diffstat (limited to 'tests/errors')
-rw-r--r-- | tests/errors/cpp_bool.pyx | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/errors/cpp_bool.pyx b/tests/errors/cpp_bool.pyx new file mode 100644 index 000000000..15fa4d510 --- /dev/null +++ b/tests/errors/cpp_bool.pyx @@ -0,0 +1,13 @@ +# tag: cpp +# mode: error + +from libcpp.string cimport string + +cdef foo(): + cdef string field + if field: # field cannot be coerced to book + pass + +_ERRORS = u""" +8:7: Type 'string' not acceptable as a boolean +""" |