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
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
793552fa
Commit
793552fa
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
2d45696c
Changes
1
Hide 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 @
793552fa
...
...
@@ -433,7 +433,7 @@ class CTypedefType(BaseType):
else
:
base_code
=
public_decl
(
self
.
typedef_cname
,
dll_linkage
)
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
)
def
as_argument_type
(
self
):
...
...
@@ -4017,10 +4017,7 @@ class CppClassType(CType):
else
:
base_code
=
"%s%s"
%
(
self
.
cname
,
templates
)
if
self
.
namespace
is
not
None
:
base_code
=
"%s::%s"
%
(
self
.
namespace
.
empty_declaration_code
(),
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
=
"%s::%s"
%
(
namespace_declaration_code
(
self
.
namespace
),
base_code
)
base_code
=
public_decl
(
base_code
,
dll_linkage
)
return
self
.
base_declaration_code
(
base_code
,
entity_code
)
...
...
@@ -4443,7 +4440,7 @@ class CEnumType(CIntLike, CType):
else
:
if
self
.
namespace
:
base_code
=
"%s::%s"
%
(
self
.
namespace
.
empty_declaration_code
(
),
self
.
cname
)
namespace_declaration_code
(
self
.
namespace
),
self
.
cname
)
elif
self
.
typedef_flag
:
base_code
=
self
.
cname
else
:
...
...
@@ -5294,3 +5291,14 @@ def cap_length(s, max_prefix=63, max_len=1024):
return
s
else
:
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