Commit bfd1aa79 authored by Robert Bradshaw's avatar Robert Bradshaw

Explicit error on declaring a reference type.

This is better than generating invalid code; see #1695.
parent fac03468
...@@ -1314,6 +1314,8 @@ class CVarDefNode(StatNode): ...@@ -1314,6 +1314,8 @@ class CVarDefNode(StatNode):
if name == '': if name == '':
error(declarator.pos, "Missing name in declaration.") error(declarator.pos, "Missing name in declaration.")
return return
if type.is_reference and self.visibility != 'extern':
error(declarator.pos, "C++ references cannot be declared; use a pointer instead")
if type.is_cfunction: if type.is_cfunction:
if 'staticmethod' in env.directives: if 'staticmethod' in env.directives:
type.is_static_method = True type.is_static_method = True
......
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