Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gwenaël Samain
cython
Commits
b1ef20ad
Commit
b1ef20ad
authored
Mar 31, 2015
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix const ref temporaries.
parent
ebb29b0e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
3 deletions
+5
-3
Cython/Compiler/Code.py
Cython/Compiler/Code.py
+1
-1
tests/run/cpp_template_ref_args.h
tests/run/cpp_template_ref_args.h
+1
-0
tests/run/cpp_template_ref_args.pyx
tests/run/cpp_template_ref_args.pyx
+3
-2
No files found.
Cython/Compiler/Code.py
View file @
b1ef20ad
...
...
@@ -626,7 +626,7 @@ class FunctionState(object):
A C string referring to the variable is returned.
"""
if type.is_const:
if type.is_const
and not type.is_reference
:
type = type.const_base_type
if not type.is_pyobject and not type.is_memoryviewslice:
# Make manage_ref canonical, so that manage_ref will always mean
...
...
tests/run/cpp_template_ref_args.h
View file @
b1ef20ad
...
...
@@ -4,6 +4,7 @@
template
<
typename
T
>
struct
Bar
{
Bar
&
ref
()
{
return
*
this
;
}
const
Bar
&
const_ref
()
{
return
*
this
;
}
T
value
;
};
...
...
tests/run/cpp_template_ref_args.pyx
View file @
b1ef20ad
...
...
@@ -8,6 +8,7 @@ cdef extern from "cpp_template_ref_args.h":
# bug: Bar[T] created before class fully defined
T
value
Bar
[
T
]
&
ref
()
except
+
const
Bar
[
T
]
&
const_ref
()
except
+
cdef
cppclass
Foo
[
T
]:
Foo
()
...
...
@@ -33,8 +34,8 @@ def test_template_ref_arg(int x):
def
test_template_ref_attr
(
int
x
):
"""
>>> test_template_ref_attr(4)
4
(4, 4)
"""
cdef
Bar
[
int
]
bar
bar
.
value
=
x
return
bar
.
ref
().
value
return
bar
.
ref
().
value
,
bar
.
const_ref
().
value
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment