Commit ebef63ea authored by Mark's avatar Mark

Merge pull request #79 from dtcaciuc/master

Fix C++ reference to C++ reference coercion
parents 59820426 b185d25f
......@@ -600,7 +600,7 @@ class ExprNode(Node):
if self.check_for_coercion_error(dst_type):
return self
if dst_type.is_reference:
if dst_type.is_reference and not src_type.is_reference:
dst_type = dst_type.ref_base_type
if src_type.is_fused or dst_type.is_fused:
......
#ifndef _TEMPLATE_ARGS_H_
#define _TEMPLATE_ARGS_H_
template <typename T>
struct Bar {
Bar & ref() { return *this; }
T value;
};
template <typename T>
struct Foo {
int bar_value(const Bar<int> & bar) { return bar.value; }
};
#endif
# tag: cpp
cdef extern from "cpp_template_ref_args.h":
cdef cppclass Bar[T]:
Bar()
Bar[T] & ref()
T value
cdef cppclass Foo[T]:
Foo()
int bar_value(Bar[int] & bar)
def test_template_ref_arg(int x):
"""
>>> test_template_ref_arg(4)
4
"""
# Templated reference parameters in method
# of templated classes were not properly coalesced.
cdef Foo[size_t] foo
cdef Bar[int] bar
bar.value = x
return foo.bar_value(bar.ref())
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment