Commit e41c71a6 authored by Celelibi's avatar Celelibi Committed by GitHub

Avoid "uninitialised" warnings for sizeof and typeid (GH-3631)

Closes #3575
parent d2d29932
......@@ -885,6 +885,12 @@ class ControlFlowAnalysis(CythonTransform):
self.mark_position(node)
return node
def visit_SizeofVarNode(self, node):
return node
def visit_TypeidNode(self, node):
return node
def visit_IfStatNode(self, node):
next_block = self.flow.newblock()
parent = self.flow.block
......
......@@ -112,6 +112,10 @@ def class_py3k_args():
args = []
kwargs = {}
def uninitialized_in_sizeof():
cdef int i
print sizeof(i)
_ERRORS = """
6:10: local variable 'a' referenced before assignment
12:11: local variable 'a' might be referenced before assignment
......
# cython: warn.maybe_uninitialized=True
# mode: error
# tag: cpp, werror
from cython.operator import typeid
def uninitialized_in_typeid():
cdef int i
print typeid(i) == typeid(i)
_ERRORS = """
"""
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment