diff options
Diffstat (limited to 'tests/compile/cpp_rvalue_reference_binding.pyx')
-rw-r--r-- | tests/compile/cpp_rvalue_reference_binding.pyx | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/compile/cpp_rvalue_reference_binding.pyx b/tests/compile/cpp_rvalue_reference_binding.pyx new file mode 100644 index 000000000..492a950ac --- /dev/null +++ b/tests/compile/cpp_rvalue_reference_binding.pyx @@ -0,0 +1,22 @@ +# tag: cpp, cpp11 +# mode: compile + +cdef extern from *: + """ + template <typename T> + void accept(T&& x) { (void) x; } + """ + cdef void accept[T](T&& x) + +cdef int make_int_py() except *: + # might raise Python exception (thus needs a temp) + return 1 + +cdef int make_int_cpp() except +: + # might raise C++ exception (thus needs a temp) + return 1 + +def test_func_arg(): + # won't compile if move() isn't called on the temp: + accept(make_int_py()) + accept(make_int_cpp()) |