From 08d63e3408bb35afd8b0fffc4e895a0379d7223b Mon Sep 17 00:00:00 2001 From: Jonas Maebe Date: Sun, 10 Apr 2016 21:27:29 +0000 Subject: [PATCH] * allow default parameters for constref (mantis #29992) git-svn-id: trunk@33480 - --- .gitattributes | 1 + compiler/pdecsub.pas | 2 +- tests/webtbs/tw29992.pp | 11 +++++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 tests/webtbs/tw29992.pp diff --git a/.gitattributes b/.gitattributes index 0cef9a3d8b..c4e2fc122f 100644 --- a/.gitattributes +++ b/.gitattributes @@ -15004,6 +15004,7 @@ tests/webtbs/tw29930.pp svneol=native#text/plain tests/webtbs/tw29958.pp svneol=native#text/pascal tests/webtbs/tw2998.pp svneol=native#text/plain tests/webtbs/tw2999.pp svneol=native#text/plain +tests/webtbs/tw29992.pp svneol=native#text/plain tests/webtbs/tw3004.pp svneol=native#text/plain tests/webtbs/tw3005.pp svneol=native#text/plain tests/webtbs/tw3010.pp svneol=native#text/plain diff --git a/compiler/pdecsub.pas b/compiler/pdecsub.pas index 229d783c17..f61f9b8983 100644 --- a/compiler/pdecsub.pas +++ b/compiler/pdecsub.pas @@ -261,7 +261,7 @@ implementation vs:=tparavarsym(sc[0]); if sc.count>1 then Message(parser_e_default_value_only_one_para); - if not(vs.varspez in [vs_value,vs_const]) then + if not(vs.varspez in [vs_value,vs_const,vs_constref]) then Message(parser_e_default_value_val_const); bt:=block_type; block_type:=bt_const; diff --git a/tests/webtbs/tw29992.pp b/tests/webtbs/tw29992.pp new file mode 100644 index 0000000000..fe64c34368 --- /dev/null +++ b/tests/webtbs/tw29992.pp @@ -0,0 +1,11 @@ +{ %norun } + +{$mode objfpc} + +procedure Test(constref AParam: String = 'def_param'); +begin + writeln(AParam); +end; + +begin +end.