Make cpp redeclaration an error (vs. a compiler crash). Fixes #523.
authorRobert Bradshaw <robertwb@math.washington.edu>
Sat, 19 Feb 2011 22:24:57 +0000 (14:24 -0800)
committerRobert Bradshaw <robertwb@math.washington.edu>
Sat, 19 Feb 2011 22:24:57 +0000 (14:24 -0800)
Cython/Compiler/Nodes.py
Cython/Compiler/Symtab.py

index 375a4621f7a712fa3aee6282b819c8010e15b52a..c41c681493c7e94527339ed4fc60070d6475d930 100644 (file)
@@ -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:
index 74a80eb834111c1cae2cf1af1d3c47cf95a03351..dcd21613f034fcc0a90f1af26d78fc0f60f95632 100644 (file)
@@ -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: