summaryrefslogtreecommitdiff
path: root/tests/errors/cpp_no_const_iterator_conversion.pyx
blob: 9772e094ad9b2884af908823b409c6e6f6d7cbf6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# mode: error
# tag: cpp

from libcpp.deque cimport deque
from libcpp.list cimport list
from libcpp.map cimport map
from libcpp.set cimport set
from libcpp.string cimport string
from libcpp.unordered_map cimport unordered_map
from libcpp.unordered_set cimport unordered_set
from libcpp.vector cimport vector

def deque_iterator():
    cdef deque[int].iterator begin
    cdef deque[int].const_iterator cbegin = begin
    begin = cbegin

def list_iterator():
    cdef list[int].iterator begin
    cdef list[int].const_iterator cbegin = begin
    begin = cbegin

def map_iterator():
    cdef map[int, int].iterator begin
    cdef map[int, int].const_iterator cbegin = begin
    begin = cbegin

def set_iterator():
    cdef set[int].iterator begin
    cdef set[int].const_iterator cbegin = begin
    begin = cbegin

def string_iterator():
    cdef string.iterator begin
    cdef string.const_iterator cbegin = begin
    begin = cbegin

def map_iterator():
    cdef unordered_map[int, int].iterator begin
    cdef unordered_map[int, int].const_iterator cbegin = begin
    begin = cbegin

def set_iterator():
    cdef unordered_set[int].iterator begin
    cdef unordered_set[int].const_iterator cbegin = begin
    begin = cbegin

def vector_iterator():
    cdef vector[int].iterator begin
    cdef vector[int].const_iterator cbegin = begin
    begin = cbegin

_ERRORS = u"""
16:12: Cannot assign type 'const_iterator' to 'iterator'
21:12: Cannot assign type 'const_iterator' to 'iterator'
26:12: Cannot assign type 'const_iterator' to 'iterator'
31:12: Cannot assign type 'const_iterator' to 'iterator'
36:12: Cannot assign type 'const_iterator' to 'iterator'
41:12: Cannot assign type 'const_iterator' to 'iterator'
46:12: Cannot assign type 'const_iterator' to 'iterator'
51:12: Cannot assign type 'const_iterator' to 'iterator'
"""