@@ -390,7 +390,7 @@ def resolve_dependancy(dep):
390390 types = [assmt .rhs .infer_type (scope )
391391 for assmt in entry .cf_assignments ]
392392 if types and Utils .all (types ):
393- entry .type = spanning_type (types , entry .might_overflow )
393+ entry .type = spanning_type (types , entry .might_overflow , entry . pos )
394394 else :
395395 # FIXME: raise a warning?
396396 # print "No assignments", entry.pos, entry
@@ -405,10 +405,10 @@ def resolve_dependancy(dep):
405405 for assmt in entry .cf_assignments
406406 if assmt .type_dependencies (scope ) == ()]
407407 if types :
408- entry .type = spanning_type (types , entry .might_overflow )
408+ entry .type = spanning_type (types , entry .might_overflow , entry . pos )
409409 types = [assmt .infer_type (scope )
410410 for assmt in entry .cf_assignments ]
411- entry .type = spanning_type (types , entry .might_overflow ) # might be wider...
411+ entry .type = spanning_type (types , entry .might_overflow , entry . pos ) # might be wider...
412412 resolve_dependancy (entry )
413413 del dependancies_by_entry [entry ]
414414 if ready_to_infer :
@@ -438,16 +438,20 @@ def find_spanning_type(type1, type2):
438438 return PyrexTypes .c_double_type
439439 return result_type
440440
441- def aggressive_spanning_type (types , might_overflow ):
441+ def aggressive_spanning_type (types , might_overflow , pos ):
442442 result_type = reduce (find_spanning_type , types )
443443 if result_type .is_reference :
444444 result_type = result_type .ref_base_type
445+ if result_type .is_cpp_class :
446+ result_type .check_nullary_constructor (pos )
445447 return result_type
446448
447- def safe_spanning_type (types , might_overflow ):
449+ def safe_spanning_type (types , might_overflow , pos ):
448450 result_type = reduce (find_spanning_type , types )
449451 if result_type .is_reference :
450452 result_type = result_type .ref_base_type
453+ if result_type .is_cpp_class :
454+ result_type .check_nullary_constructor (pos )
451455 if result_type .is_pyobject :
452456 # In theory, any specific Python type is always safe to
453457 # infer. However, inferring str can cause some existing code
0 commit comments