diff --git a/.gitattributes b/.gitattributes index 8ca6d67771..0630f6f74a 100644 --- a/.gitattributes +++ b/.gitattributes @@ -13218,6 +13218,8 @@ tests/test/tcustomattr17.pp svneol=native#text/pascal tests/test/tcustomattr18.pp svneol=native#text/pascal tests/test/tcustomattr19.pp svneol=native#text/pascal tests/test/tcustomattr2.pp svneol=native#text/pascal +tests/test/tcustomattr20.pp svneol=native#text/pascal +tests/test/tcustomattr21.pp svneol=native#text/pascal tests/test/tcustomattr3.pp svneol=native#text/pascal tests/test/tcustomattr4.pp svneol=native#text/pascal tests/test/tcustomattr5.pp svneol=native#text/pascal diff --git a/compiler/pdecl.pas b/compiler/pdecl.pas index b3fb7da85b..b721958aed 100644 --- a/compiler/pdecl.pas +++ b/compiler/pdecl.pas @@ -447,7 +447,11 @@ implementation { Check if the attribute class is related to TCustomAttribute } if not is_system_custom_attribute_descendant(od) then - incompatibletypes(od,class_tcustomattribute); + begin + incompatibletypes(od,class_tcustomattribute); + read_attr_paras.free; + continue; + end; paran:=read_attr_paras; diff --git a/tests/test/tcustomattr20.pp b/tests/test/tcustomattr20.pp new file mode 100644 index 0000000000..954cca8537 --- /dev/null +++ b/tests/test/tcustomattr20.pp @@ -0,0 +1,15 @@ +{ %FAIL } +program tcustomattr20; + +{$mode objfpc}{$H+} +{$modeswitch prefixedattributes} + +type + { ensure that arguments of non existing attributes are skipped correctly } + [TMyAttributeDoesNotExist('Alpha', 42)] + TMyObject = class(TObject) + end; + +begin +end. + diff --git a/tests/test/tcustomattr21.pp b/tests/test/tcustomattr21.pp new file mode 100644 index 0000000000..2c84d9f102 --- /dev/null +++ b/tests/test/tcustomattr21.pp @@ -0,0 +1,26 @@ +{ %fail } +program tcustomattr21; + +{$mode objfpc}{$H+} +{$modeswitch prefixedattributes} + +type + + { tmyt } + + tmyt = class + constructor create; + end; + + { ensure that arguments are skipped correctly } + [tmyt('Alpha', 42)] + TMyObject = class(TObject) + end; + +constructor tmyt.create; +begin +end; + +begin +end. +