mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-13 09:59:25 +02:00
* fix for Mantis #30534: don't consider all types with generic constraints as equal, but at least ensure that they have the same basetype (Note: this still needs a bit more improvement)
+ added test git-svn-id: trunk@34526 -
This commit is contained in:
parent
458aea707d
commit
0500c678e5
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -15223,6 +15223,7 @@ tests/webtbs/tw30443.pp svneol=native#text/plain
|
||||
tests/webtbs/tw3045.pp svneol=native#text/plain
|
||||
tests/webtbs/tw3048.pp svneol=native#text/plain
|
||||
tests/webtbs/tw30522.pp svneol=native#text/plain
|
||||
tests/webtbs/tw30534.pp svneol=native#text/pascal
|
||||
tests/webtbs/tw30570.pp svneol=native#text/plain
|
||||
tests/webtbs/tw30572.pp svneol=native#text/plain
|
||||
tests/webtbs/tw3063.pp svneol=native#text/plain
|
||||
|
@ -275,20 +275,33 @@ implementation
|
||||
end
|
||||
else
|
||||
begin
|
||||
{ undefined defs or defs with generic constraints are
|
||||
considered equal to everything }
|
||||
if (
|
||||
(def_from.typ=undefineddef) or
|
||||
assigned(tstoreddef(def_from).genconstraintdata)
|
||||
) or (
|
||||
(def_to.typ=undefineddef) or
|
||||
assigned(tstoreddef(def_to).genconstraintdata)
|
||||
) then
|
||||
begin
|
||||
doconv:=tc_equal;
|
||||
compare_defs_ext:=te_exact;
|
||||
exit;
|
||||
end;
|
||||
{ undefined defs are considered equal to everything }
|
||||
if (def_from.typ=undefineddef) or
|
||||
(def_to.typ=undefineddef) then
|
||||
begin
|
||||
doconv:=tc_equal;
|
||||
compare_defs_ext:=te_exact;
|
||||
exit;
|
||||
end;
|
||||
|
||||
{ either type has constraints }
|
||||
if assigned(tstoreddef(def_from).genconstraintdata) or
|
||||
assigned(tstoreddef(def_to).genconstraintdata) then
|
||||
begin
|
||||
if def_from.typ<>def_to.typ then
|
||||
begin
|
||||
{ not compatible anyway }
|
||||
doconv:=tc_not_possible;
|
||||
compare_defs_ext:=te_incompatible;
|
||||
exit;
|
||||
end;
|
||||
|
||||
{ one is definitely a constraint, for the other we don't
|
||||
care right now }
|
||||
doconv:=tc_equal;
|
||||
compare_defs_ext:=te_exact;
|
||||
exit;
|
||||
end;
|
||||
end;
|
||||
|
||||
{ two specializations are considered equal if they specialize the same
|
||||
|
18
tests/webtbs/tw30534.pp
Normal file
18
tests/webtbs/tw30534.pp
Normal file
@ -0,0 +1,18 @@
|
||||
{ %NORUN }
|
||||
|
||||
{$MODE DELPHI}
|
||||
|
||||
type
|
||||
TSmartPtr<T: class> = record
|
||||
class operator Implicit(aValue: T): TSmartPtr<T>;
|
||||
end;
|
||||
|
||||
class operator TSmartPtr<T>.Implicit(aValue: T): TSmartPtr<T>;
|
||||
begin
|
||||
end;
|
||||
|
||||
var
|
||||
sp: TSmartPtr<TObject>;
|
||||
begin
|
||||
sp := nil;
|
||||
end.
|
Loading…
Reference in New Issue
Block a user