summaryrefslogtreecommitdiff
path: root/tests/compile/cpp_rvalue_reference_binding.pyx
blob: 492a950ac4f4127ee632d47d5017732cf2cb74fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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())