Commit c711c46a authored by Robert Bradshaw's avatar Robert Bradshaw

Fix T767 - template specialization leaks into builtin types

parent 058a5e89
...@@ -412,7 +412,8 @@ class Scope(object): ...@@ -412,7 +412,8 @@ class Scope(object):
return entry return entry
def declare_type(self, name, type, pos, def declare_type(self, name, type, pos,
cname = None, visibility = 'private', api = 0, defining = 1, shadow = 0): cname = None, visibility = 'private', api = 0, defining = 1,
shadow = 0, template = 0):
# Add an entry for a type definition. # Add an entry for a type definition.
if not cname: if not cname:
cname = name cname = name
...@@ -422,7 +423,8 @@ class Scope(object): ...@@ -422,7 +423,8 @@ class Scope(object):
if defining: if defining:
self.type_entries.append(entry) self.type_entries.append(entry)
type.entry = entry if not template:
type.entry = entry
# here we would set as_variable to an object representing this type # here we would set as_variable to an object representing this type
return entry return entry
...@@ -2052,9 +2054,10 @@ class CppClassScope(Scope): ...@@ -2052,9 +2054,10 @@ class CppClassScope(Scope):
for entry in self.entries.values(): for entry in self.entries.values():
if entry.is_type: if entry.is_type:
scope.declare_type(entry.name, scope.declare_type(entry.name,
entry.type.specialize(values), entry.type.specialize(values),
entry.pos, entry.pos,
entry.cname) entry.cname,
template=1)
else: else:
# scope.declare_var(entry.name, # scope.declare_var(entry.name,
# entry.type.specialize(values), # entry.type.specialize(values),
......
# tag: cpp # tag: cpp
# mode: compile # mode: compile
# ticket: 767
cdef extern from "templates.h": cdef extern from "templates.h":
cdef cppclass TemplateTest1[T]: cdef cppclass TemplateTest1[T]:
...@@ -35,3 +36,6 @@ del b, e ...@@ -35,3 +36,6 @@ del b, e
ctypedef TemplateTest1[int] TemplateTest1_int ctypedef TemplateTest1[int] TemplateTest1_int
cdef TemplateTest1_int aa cdef TemplateTest1_int aa
# Verify that T767 is fixed.
cdef public int func(int arg):
return arg
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