This commit is contained in:
parent
3743c07129
commit
5a20ef15dc
13
TestSuite/errors/err0402.pas
Normal file
13
TestSuite/errors/err0402.pas
Normal 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.
|
||||||
|
|
@ -1345,7 +1345,7 @@ namespace PascalABCCompiler.TreeRealization
|
||||||
|
|
||||||
public static bool type_has_default_ctor(type_node tn, bool find_protected_ctors)
|
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;
|
return false;
|
||||||
List<SymbolInfo> sil = tn.find_in_type(compiler_string_consts.default_constructor_name, tn.Scope);
|
List<SymbolInfo> sil = tn.find_in_type(compiler_string_consts.default_constructor_name, tn.Scope);
|
||||||
if (sil != null)
|
if (sil != null)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue