bug fix #2555
This commit is contained in:
parent
0adae8b26d
commit
9f4de084cc
|
|
@ -1,13 +1,19 @@
|
|||
type TRec = record
|
||||
type TRec = record
|
||||
a: integer;
|
||||
b: real;
|
||||
c: char;
|
||||
end;
|
||||
|
||||
type
|
||||
t1 = class
|
||||
o: t1;
|
||||
end;
|
||||
|
||||
begin
|
||||
assert(sizeof(integer)=4);
|
||||
assert(sizeof(real)=8);
|
||||
assert(sizeof(char)=2);
|
||||
assert(sizeof(pointer)=System.Runtime.InteropServices.Marshal.SizeOf(typeof(pointer)));
|
||||
assert(sizeof(TRec)=System.Runtime.InteropServices.Marshal.SizeOf(typeof(TRec)));
|
||||
assert(sizeof(t1) > 0);
|
||||
end.
|
||||
|
|
@ -3731,6 +3731,8 @@ namespace PascalABCCompiler.TreeConverter
|
|||
switch (_class_definition.keyword)
|
||||
{
|
||||
case PascalABCCompiler.SyntaxTree.class_keyword.Class:
|
||||
//if (context.converted_type.IsPartial)
|
||||
// generic_convertions.remove_type_instances(context.converted_type);
|
||||
if (context.converted_type.is_value || context.converted_type.IsInterface)
|
||||
{
|
||||
AddError(get_location(_class_definition), "FORWARD_DECLARATION_OF_{0}_MISMATCH_DECLARATION", context.converted_type.name);
|
||||
|
|
@ -19445,7 +19447,7 @@ namespace PascalABCCompiler.TreeConverter
|
|||
if (tn.is_generic_parameter || tn.is_generic_type_definition || tn.is_generic_type_instance)
|
||||
return false;
|
||||
foreach (class_field cf in ctn.fields)
|
||||
if (!cf.IsStatic)
|
||||
if (!cf.IsStatic && cf.type != tn)
|
||||
if (!can_evaluate_size(cf.type)) return false;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -243,6 +243,12 @@ namespace PascalABCCompiler.TreeRealization
|
|||
return instances;
|
||||
}
|
||||
|
||||
public static void remove_type_instances(type_node original_generic_type)
|
||||
{
|
||||
if (generic_instances[original_generic_type] != null)
|
||||
generic_instances.Remove(original_generic_type);
|
||||
}
|
||||
|
||||
public static List<generic_function_instance_info> get_function_instances(function_node original_generic_function)
|
||||
{
|
||||
List<generic_function_instance_info> instances = generic_instances[original_generic_function] as List<generic_function_instance_info>;
|
||||
|
|
|
|||
Loading…
Reference in a new issue