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
3c62a75e
Commit
3c62a75e
authored
Aug 23, 2014
by
scoder
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #317 from larsmans/nested_templates
fix bug in nested C++ template syntax
parents
9c8d1ec4
8baa9dba
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
3 deletions
+16
-3
Cython/Compiler/PyrexTypes.py
Cython/Compiler/PyrexTypes.py
+1
-3
tests/compile/cpp_templates.pyx
tests/compile/cpp_templates.pyx
+10
-0
tests/compile/templates.h
tests/compile/templates.h
+5
-0
No files found.
Cython/Compiler/PyrexTypes.py
View file @
3c62a75e
...
@@ -3153,10 +3153,8 @@ class CppClassType(CType):
...
@@ -3153,10 +3153,8 @@ class CppClassType(CType):
if
for_display
:
if
for_display
:
brackets
=
"[%s]"
brackets
=
"[%s]"
else
:
else
:
brackets
=
"<%s>"
brackets
=
"<%s>
"
templates
=
brackets
%
","
.
join
(
template_strings
)
templates
=
brackets
%
","
.
join
(
template_strings
)
if
templates
[
-
2
:]
==
">>"
:
templates
=
templates
[:
-
2
]
+
"> >"
else
:
else
:
templates
=
""
templates
=
""
if
pyrex
or
for_display
:
if
pyrex
or
for_display
:
...
...
tests/compile/cpp_templates.pyx
View file @
3c62a75e
...
@@ -16,6 +16,8 @@ cdef extern from "templates.h":
...
@@ -16,6 +16,8 @@ cdef extern from "templates.h":
T
getValue1
()
T
getValue1
()
U
getValue2
()
U
getValue2
()
void
template_function
[
T
](
TemplateTest1
[
T
]
&
)
cdef
TemplateTest1
[
int
]
a
cdef
TemplateTest1
[
int
]
a
cdef
TemplateTest1
[
int
]
*
b
=
new
TemplateTest1
[
int
]()
cdef
TemplateTest1
[
int
]
*
b
=
new
TemplateTest1
[
int
]()
...
@@ -39,3 +41,11 @@ cdef TemplateTest1_int aa
...
@@ -39,3 +41,11 @@ cdef TemplateTest1_int aa
# Verify that T767 is fixed.
# Verify that T767 is fixed.
cdef
public
int
func
(
int
arg
):
cdef
public
int
func
(
int
arg
):
return
arg
return
arg
# Regression test: the function call used to produce
# template_function<TemplateTest1<int>>(__pyx_v_t);
# which is valid C++11, but not valid C++98 because the ">>" would be
# parsed as a single token.
cdef
public
void
use_nested_templates
():
cdef
TemplateTest1
[
TemplateTest1
[
int
]]
t
template_function
(
t
)
tests/compile/templates.h
View file @
3c62a75e
...
@@ -22,4 +22,9 @@ public:
...
@@ -22,4 +22,9 @@ public:
U
getValue2
()
{
return
value2
;
}
U
getValue2
()
{
return
value2
;
}
};
};
template
<
typename
T
>
void
template_function
(
TemplateTest1
<
T
>
&
)
{
}
#endif
#endif
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