From: Robert Bradshaw Date: Tue, 15 Dec 2009 11:07:58 +0000 (-0800) Subject: merge X-Git-Tag: 0.13.beta0~353^2~32 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=4df01a09a927c422fa102d2462a4a812f617f558;p=cython.git merge --- 4df01a09a927c422fa102d2462a4a812f617f558 diff --cc Cython/Compiler/Parsing.py index 495abe23,789429b7..81642945 --- a/Cython/Compiler/Parsing.py +++ b/Cython/Compiler/Parsing.py @@@ -1990,6 -1988,12 +1988,12 @@@ def p_c_simple_declarator(s, ctx, empty result = Nodes.CPtrDeclaratorNode(pos, base = Nodes.CPtrDeclaratorNode(pos, base = base)) - elif s.sy == '&' and Options.cplus: ++ elif s.sy == '&': + s.next() + base = p_c_declarator(s, ctx, empty = empty, is_type = is_type, + cmethod_flag = cmethod_flag, + assignable = assignable, nonempty = nonempty) + result = Nodes.CReferenceDeclaratorNode(pos, base = base) else: rhs = None if s.sy == 'IDENT': diff --cc Cython/Compiler/PyrexTypes.py index f536ffb5,514805fe..26e4fb09 --- a/Cython/Compiler/PyrexTypes.py +++ b/Cython/Compiler/PyrexTypes.py @@@ -1041,8 -1042,19 +1042,19 @@@ class CReferenceType(CType) for_display, dll_linkage, pyrex) def assignable_from_resolved_type(self, other_type): - return 0 #TODO (Danilo) implement this - + if other_type is error_type: + return 1 + if other_type.is_ptr: + if other_type.base_type == self.base_type: + return 1 + else: + pass - #should send a warning message: initialization from incompatible pointer type (in C/C++) ++ #TODO: should send a warning message: initialization from incompatible pointer type (in C/C++) + if other_type == self.base_type: + return 1 + else: #for now + return 0 + def specialize(self, values): base_type = self.base_type.specialize(values) if base_type == self.base_type: @@@ -1797,6 -1809,9 +1809,10 @@@ def is_promotion(type, other_type) return False def best_match(args, functions, pos): - '''Finds the best function to be called - Error if no function fits the call or an ambiguity is find (two or more possible functions)''' - #print functions ++ """ ++ Finds the best function to be called ++ Error if no function fits the call or an ambiguity is find (two or more possible functions) ++ """ actual_nargs = len(args) possibilities = [] bad_types = 0 diff --cc Cython/Compiler/Symtab.py index 0be550e8,bc014479..aa9c51d3 --- a/Cython/Compiler/Symtab.py +++ b/Cython/Compiler/Symtab.py @@@ -316,7 -319,10 +316,10 @@@ class Scope(object) entry.in_cinclude = self.in_cinclude if name: entry.qualified_name = self.qualify_name(name) - entries[name] = entry - if name not in entries: - entries[name] = entry - else: ++ if name in entries and self.is_cpp(): + entries[name].overloaded_alternatives.append(entry) ++ else: ++ entries[name] = entry entry.scope = self entry.visibility = visibility return entry @@@ -695,9 -698,6 +698,13 @@@ if name in self.entries: return 1 return 0 + + def is_cpp(self): - return self.outer_scope.is_cpp() ++ outer = self.outer_scope ++ if outer is None: ++ return False ++ else: ++ return outer.is_cpp() class PreImportScope(Scope):