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
Xavier Thompson
cython
Commits
9586d928
Commit
9586d928
authored
Jul 21, 2020
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix type declarations with template-dependent namespaces needing 'typename'
parent
20c64594
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
6 deletions
+14
-6
Cython/Compiler/PyrexTypes.py
Cython/Compiler/PyrexTypes.py
+14
-6
No files found.
Cython/Compiler/PyrexTypes.py
View file @
9586d928
...
@@ -433,7 +433,7 @@ class CTypedefType(BaseType):
...
@@ -433,7 +433,7 @@ class CTypedefType(BaseType):
else
:
else
:
base_code
=
public_decl
(
self
.
typedef_cname
,
dll_linkage
)
base_code
=
public_decl
(
self
.
typedef_cname
,
dll_linkage
)
if
self
.
typedef_namespace
is
not
None
and
not
pyrex
:
if
self
.
typedef_namespace
is
not
None
and
not
pyrex
:
base_code
=
"%s::%s"
%
(
self
.
typedef_namespace
.
empty_declaration_code
(
),
base_code
)
base_code
=
"%s::%s"
%
(
namespace_declaration_code
(
self
.
typedef_namespace
),
base_code
)
return
self
.
base_declaration_code
(
base_code
,
entity_code
)
return
self
.
base_declaration_code
(
base_code
,
entity_code
)
def
as_argument_type
(
self
):
def
as_argument_type
(
self
):
...
@@ -4017,10 +4017,7 @@ class CppClassType(CType):
...
@@ -4017,10 +4017,7 @@ class CppClassType(CType):
else
:
else
:
base_code
=
"%s%s"
%
(
self
.
cname
,
templates
)
base_code
=
"%s%s"
%
(
self
.
cname
,
templates
)
if
self
.
namespace
is
not
None
:
if
self
.
namespace
is
not
None
:
base_code
=
"%s::%s"
%
(
self
.
namespace
.
empty_declaration_code
(),
base_code
)
base_code
=
"%s::%s"
%
(
namespace_declaration_code
(
self
.
namespace
),
base_code
)
if
(
self
.
namespace
.
templates
is
not
None
and
any
(
isinstance
(
t
,
TemplatePlaceholderType
)
for
t
in
self
.
namespace
.
templates
)):
base_code
=
"typename %s"
%
base_code
base_code
=
public_decl
(
base_code
,
dll_linkage
)
base_code
=
public_decl
(
base_code
,
dll_linkage
)
return
self
.
base_declaration_code
(
base_code
,
entity_code
)
return
self
.
base_declaration_code
(
base_code
,
entity_code
)
...
@@ -4443,7 +4440,7 @@ class CEnumType(CIntLike, CType):
...
@@ -4443,7 +4440,7 @@ class CEnumType(CIntLike, CType):
else
:
else
:
if
self
.
namespace
:
if
self
.
namespace
:
base_code
=
"%s::%s"
%
(
base_code
=
"%s::%s"
%
(
self
.
namespace
.
empty_declaration_code
(
),
self
.
cname
)
namespace_declaration_code
(
self
.
namespace
),
self
.
cname
)
elif
self
.
typedef_flag
:
elif
self
.
typedef_flag
:
base_code
=
self
.
cname
base_code
=
self
.
cname
else
:
else
:
...
@@ -5294,3 +5291,14 @@ def cap_length(s, max_prefix=63, max_len=1024):
...
@@ -5294,3 +5291,14 @@ def cap_length(s, max_prefix=63, max_len=1024):
return
s
return
s
else
:
else
:
return
'%x__%s__etc'
%
(
abs
(
hash
(
s
))
%
(
1
<<
20
),
s
[:
max_len
-
17
])
return
'%x__%s__etc'
%
(
abs
(
hash
(
s
))
%
(
1
<<
20
),
s
[:
max_len
-
17
])
def
namespace_declaration_code
(
namespace
):
"""
Add 'typename' to the beginning of the declaration code when the namespace is template-dependent
"""
base_code
=
namespace
.
empty_declaration_code
()
if
not
base_code
.
startswith
(
"typename "
):
if
hasattr
(
namespace
,
'templates'
)
and
namespace
.
templates
is
not
None
:
if
any
(
isinstance
(
t
,
TemplatePlaceholderType
)
for
t
in
namespace
.
templates
):
base_code
=
"typename %s"
%
base_code
return
base_code
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