mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-21 09:09:30 +02:00
* don't allow default parameter values for parameter types that don't accept
constant values (i.e., anything non-value/const/constref) (mantis #263363) o fixed default parameter value for var-parameter in chmreader git-svn-id: trunk@28016 -
This commit is contained in:
parent
195dbc15fa
commit
2df1d5ec58
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -12755,6 +12755,8 @@ tests/webtbf/tw25915.pp svneol=native#text/pascal
|
||||
tests/webtbf/tw25951.pp svneol=native#text/pascal
|
||||
tests/webtbf/tw26176.pp svneol=native#text/pascal
|
||||
tests/webtbf/tw26193.pp svneol=native#text/pascal
|
||||
tests/webtbf/tw26363.pp svneol=native#text/plain
|
||||
tests/webtbf/tw26363a.pp svneol=native#text/plain
|
||||
tests/webtbf/tw2650.pp svneol=native#text/plain
|
||||
tests/webtbf/tw2657.pp svneol=native#text/plain
|
||||
tests/webtbf/tw2670.pp svneol=native#text/plain
|
||||
|
@ -405,7 +405,7 @@ scan_w_invalid_stacksize=02096_W_The specified stack size is not within the vali
|
||||
#
|
||||
# Parser
|
||||
#
|
||||
# 03336 is the last used one
|
||||
# 03337 is the last used one
|
||||
#
|
||||
% \section{Parser messages}
|
||||
% This section lists all parser messages. The parser takes care of the
|
||||
@ -1513,6 +1513,12 @@ parser_e_overloaded_have_same_mangled_name=03336_E_Overloaded routines have the
|
||||
% a prescribed way, and this encoding may map different Pascal types to the same encoded
|
||||
% (a.k.a.\ ``mangled'') name. This error can only be solved by removing or changing the
|
||||
% conflicting definitions' parameter declarations or routine names.
|
||||
parser_e_default_value_val_const=03337_E_Default values can only be specified for value, const and constref parameters
|
||||
% A default parameter value allows you to not specify a value for this parameter
|
||||
% when calling the routine, and the compiler will instead pass the specified
|
||||
% default (constant) value. As a result, default values can only be specified
|
||||
% for parameters that can accept constant values.
|
||||
%
|
||||
%
|
||||
%
|
||||
% \end{description}
|
||||
|
@ -436,6 +436,7 @@ const
|
||||
parser_e_no_assembler_in_generic=03334;
|
||||
parser_e_property_only_sgr=03335;
|
||||
parser_e_overloaded_have_same_mangled_name=03336;
|
||||
parser_e_default_value_val_const=03337;
|
||||
type_e_mismatch=04000;
|
||||
type_e_incompatible_types=04001;
|
||||
type_e_not_equal_types=04002;
|
||||
@ -988,9 +989,9 @@ const
|
||||
option_info=11024;
|
||||
option_help_pages=11025;
|
||||
|
||||
MsgTxtSize = 71440;
|
||||
MsgTxtSize = 71526;
|
||||
|
||||
MsgIdxMax : array[1..20] of longint=(
|
||||
26,97,337,122,89,57,126,27,202,64,
|
||||
26,97,338,122,89,57,126,27,202,64,
|
||||
57,20,1,1,1,1,1,1,1,1
|
||||
);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -255,6 +255,8 @@ 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
|
||||
Message(parser_e_default_value_val_const);
|
||||
bt:=block_type;
|
||||
block_type:=bt_const;
|
||||
{ prefix 'def' to the parameter name }
|
||||
|
@ -156,7 +156,7 @@ type
|
||||
destructor Destroy; override;
|
||||
function GetObject(Name: String): TMemoryStream;
|
||||
function IsAnOpenFile(AFileName: String): Boolean;
|
||||
function ObjectExists(Name: String; var fChm: TChmReader = nil): QWord;
|
||||
function ObjectExists(Name: String; var fChm: TChmReader): QWord;
|
||||
//properties
|
||||
property Chm[Index: Integer]: TChmReader read GetChm;
|
||||
property FileName[Index: Integer]: String read GetFileName;
|
||||
@ -1712,7 +1712,7 @@ begin
|
||||
fUnNotifiedFiles.Clear;
|
||||
end;
|
||||
|
||||
function TChmFileList.ObjectExists(Name: String; var fChm: TChmReader = nil): QWord;
|
||||
function TChmFileList.ObjectExists(Name: String; var fChm: TChmReader): QWord;
|
||||
begin
|
||||
Result := 0;
|
||||
if Count = 0 then exit;
|
||||
|
13
tests/webtbf/tw26363.pp
Normal file
13
tests/webtbf/tw26363.pp
Normal file
@ -0,0 +1,13 @@
|
||||
{ %fail }
|
||||
|
||||
{$mode objfpc}
|
||||
|
||||
procedure test(var x: longint = 0);
|
||||
begin
|
||||
end;
|
||||
|
||||
var
|
||||
l: longint;
|
||||
begin
|
||||
test(l);
|
||||
end.
|
13
tests/webtbf/tw26363a.pp
Normal file
13
tests/webtbf/tw26363a.pp
Normal file
@ -0,0 +1,13 @@
|
||||
{ %fail }
|
||||
|
||||
{$mode objfpc}
|
||||
|
||||
procedure test(out x: longint = 0);
|
||||
begin
|
||||
end;
|
||||
|
||||
var
|
||||
l: longint;
|
||||
begin
|
||||
test(l);
|
||||
end.
|
Loading…
Reference in New Issue
Block a user