Hi,
I'm trying to improve the declarations in libcpp.string and cover them
with unit tests. In this process, I've stumbled upon a compiler crash in
overload resolution. A simple reproducer below; if the last line is
uncommented, the code compiles just fine:
cdef extern from *:
cdef cppclass string_helper:
cppclass iterator:
pass
string_helper& insert(size_t, char*, size_t)
iterator insert[input_iterator](iterator, input_iterator,
input_iterator)
def test_insert():
cdef string_helper s
cdef string_helper.iterator it
s.insert[string_helper.iterator](it, it, it)
s.insert(0, <char*>0, 0)
zaytsev@work:~/src/cython$ ./cython-git/cython.py --cplus crash.pyx
Error compiling Cython file:
------------------------------------------------------------
...
def test_insert():
cdef string_helper s
cdef string_helper.iterator it
s.insert[string_helper.iterator](it, it, it)
s.insert(0, <char*>0, 0)
^
------------------------------------------------------------
crash.pyx:13:12: Compiler crash in AnalyseExpressionsTransform
ModuleNode.body = StatListNode(crash.pyx:1:0)
StatListNode.stats[1] = DefNode(crash.pyx:9:0,
modifiers = [...]/0,
name = u'test_insert',
py_wrapper_required = True,
reqd_kw_flags_cname = '0',
used = True)
File 'Nodes.py', line 430, in analyse_expressions:
StatListNode(crash.pyx:10:4)
File 'Nodes.py', line 4755, in analyse_expressions:
ExprStatNode(crash.pyx:13:12)
File 'ExprNodes.py', line 519, in analyse_expressions:
SimpleCallNode(crash.pyx:13:12,
analysed = True,
use_managed_ref = True)
File 'ExprNodes.py', line 4938, in analyse_types:
SimpleCallNode(crash.pyx:13:12,
analysed = True,
use_managed_ref = True)
File 'ExprNodes.py', line 4992, in analyse_c_function_call:
SimpleCallNode(crash.pyx:13:12,
analysed = True,
use_managed_ref = True)
Compiler crash traceback from this point on:
File "/home/zaytsev/src/cython/cython-git/Cython/Compiler/ExprNodes.py", line
4992, in analyse_c_function_call
entry = PyrexTypes.best_match(args, alternatives, self.pos, env)
File "/home/zaytsev/src/cython/cython-git/Cython/Compiler/PyrexTypes.py",
line 4133, in best_match
[pattern.type.deduce_template_params(actual) for (pattern, actual) in
zip(func_type.args, arg_types)],
File "/home/zaytsev/src/cython/cython-git/Cython/Compiler/PyrexTypes.py",
line 3594, in deduce_template_params
elif self.empty_declaration_code() ==
actual.template_type.empty_declaration_code():
AttributeError: 'CIntType' object has no attribute 'template_type'
--
Sincerely yours,
Yury V. Zaytsev
_______________________________________________
cython-devel mailing list
cython-devel@python.org
https://mail.python.org/mailman/listinfo/cython-devel