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
Boxiang Sun
cython
Commits
09cbfe82
Commit
09cbfe82
authored
Feb 04, 2010
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More restrictions on stack allocated C++ objects.
parent
71805ed5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
0 deletions
+6
-0
Cython/Compiler/Symtab.py
Cython/Compiler/Symtab.py
+6
-0
No files found.
Cython/Compiler/Symtab.py
View file @
09cbfe82
...
...
@@ -431,6 +431,10 @@ class Scope(object):
cname = name
else:
cname = self.mangle(Naming.var_prefix, name)
if type.is_cpp_class and visibility != 'extern':
constructor = type.scope.lookup(u'<init>')
if constructor is not None and PyrexTypes.best_match([], constructor.all_alternatives()) is None:
error(pos, "
C
++
class
must
have
an
empty
constructor
to
be
stack
allocated
")
entry = self.declare(name, cname, type, pos, visibility)
entry.is_variable = 1
self.control_flow.set_state((), (name, 'initalized'), False)
...
...
@@ -1359,6 +1363,8 @@ class CClassScope(ClassScope):
cname
=
name
if
visibility
==
'private'
:
cname
=
c_safe_identifier
(
cname
)
if
type
.
is_cpp_class
and
visibility
!=
'extern'
:
error
(
pos
,
"C++ classes not allowed as members of an extension type, use a pointer or reference instead"
)
entry
=
self
.
declare
(
name
,
cname
,
type
,
pos
,
visibility
)
entry
.
is_variable
=
1
self
.
var_entries
.
append
(
entry
)
...
...
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