Browse Source

* allow default parameters for constref (mantis #29992)

git-svn-id: trunk@33480 -
Jonas Maebe 9 years ago
parent
commit
08d63e3408
3 changed files with 13 additions and 1 deletions
  1. 1 0
      .gitattributes
  2. 1 1
      compiler/pdecsub.pas
  3. 11 0
      tests/webtbs/tw29992.pp

+ 1 - 0
.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

+ 1 - 1
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;

+ 11 - 0
tests/webtbs/tw29992.pp

@@ -0,0 +1,11 @@
+{ %norun }
+
+{$mode objfpc}
+
+procedure Test(constref AParam: String = 'def_param');
+begin
+  writeln(AParam);
+end;
+
+begin
+end.