This commit is contained in:
Ivan Bondarev 2021-01-26 20:41:42 +01:00
parent 3743c07129
commit 5a20ef15dc
2 changed files with 14 additions and 1 deletions

View file

@ -0,0 +1,13 @@
type
t0 = abstract class
private constructor := exit;
end;
t1<T> = class
where T: t0, constructor;
end;
begin
new t1<t0>;
end.

View file

@ -1345,7 +1345,7 @@ namespace PascalABCCompiler.TreeRealization
public static bool type_has_default_ctor(type_node tn, bool find_protected_ctors)
{
if (tn.is_generic_parameter && tn.base_type != null && tn.base_type.IsAbstract)
if (tn.is_generic_parameter && tn.base_type != null && tn.base_type.IsAbstract && !(tn is common_type_node && (tn as common_type_node).has_default_constructor))
return false;
List<SymbolInfo> sil = tn.find_in_type(compiler_string_consts.default_constructor_name, tn.Scope);
if (sil != null)