Commit c71adccb authored by Robert Bradshaw's avatar Robert Bradshaw

Make cpp redeclaration an error (vs. a compiler crash). Fixes #523.

parent 11fd96e0
......@@ -1057,6 +1057,8 @@ class CppClassNode(CStructOrUnionDefNode):
self.entry = env.declare_cpp_class(
self.name, scope, self.pos,
self.cname, base_class_types, visibility = self.visibility, templates = template_types)
if self.entry is None:
return
self.entry.is_cpp_class = 1
if self.attributes is not None:
if self.in_pxd and not env.in_cinclude:
......
......@@ -449,7 +449,8 @@ class Scope(object):
visibility = visibility, defining = scope is not None)
else:
if not (entry.is_type and entry.type.is_cpp_class):
warning(pos, "'%s' redeclared " % name, 0)
error(pos, "'%s' redeclared " % name)
return None
elif scope and entry.type.scope:
warning(pos, "'%s' already defined (ignoring second definition)" % name, 0)
else:
......
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