mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-23 23:29:50 +02:00
* give an error if an explicit enumeration valid exceeds the valid range, resolves #34633
git-svn-id: trunk@43191 -
This commit is contained in:
parent
2d06d7ed46
commit
626ef4ae0c
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -16049,6 +16049,7 @@ tests/webtbf/tw3395.pp svneol=native#text/plain
|
||||
tests/webtbf/tw3395a.pp svneol=native#text/plain
|
||||
tests/webtbf/tw34355.pp svneol=native#text/pascal
|
||||
tests/webtbf/tw3450.pp svneol=native#text/plain
|
||||
tests/webtbf/tw34633.pp svneol=native#text/pascal
|
||||
tests/webtbf/tw34691.pp svneol=native#text/pascal
|
||||
tests/webtbf/tw3473.pp svneol=native#text/plain
|
||||
tests/webtbf/tw3480.pp svneol=native#text/plain
|
||||
|
@ -1600,6 +1600,9 @@ parser_e_callthrough_varargs=03350_E_Cannot redeclare C-style variadic function
|
||||
% platforms. Even on platforms where it is supported, this is quite inefficient.
|
||||
parser_e_unbound_attribute=03351_E_Unbound custom attribute: "$1".
|
||||
% A custom attribute is defined, but there is no identifier to bind it to.
|
||||
parser_e_enumeration_out_of_range=03352_E_Enumeration symbols can only have values in the range of -2^31 to 2^31-1
|
||||
% The size of enumeration values is limited to 4 bytes. As the value can be signed, the range
|
||||
% of valid values is limited to a signed 32 Bit value (i.e. \var{longint}).
|
||||
%
|
||||
% \end{description}
|
||||
%
|
||||
|
@ -462,6 +462,7 @@ const
|
||||
parser_e_only_static_members_via_object_type=03349;
|
||||
parser_e_callthrough_varargs=03350;
|
||||
parser_e_unbound_attribute=03351;
|
||||
parser_e_enumeration_out_of_range=03352;
|
||||
type_e_mismatch=04000;
|
||||
type_e_incompatible_types=04001;
|
||||
type_e_not_equal_types=04002;
|
||||
@ -1113,9 +1114,9 @@ const
|
||||
option_info=11024;
|
||||
option_help_pages=11025;
|
||||
|
||||
MsgTxtSize = 83621;
|
||||
MsgTxtSize = 83702;
|
||||
|
||||
MsgIdxMax : array[1..20] of longint=(
|
||||
28,106,352,126,99,61,143,34,221,68,
|
||||
28,106,353,126,99,61,143,34,221,68,
|
||||
62,20,30,1,1,1,1,1,1,1
|
||||
);
|
||||
|
1173
compiler/msgtxt.inc
1173
compiler/msgtxt.inc
File diff suppressed because it is too large
Load Diff
@ -1718,6 +1718,8 @@ implementation
|
||||
begin
|
||||
storepos:=current_tokenpos;
|
||||
current_tokenpos:=defpos;
|
||||
if (l.svalue<low(longint)) or (l.svalue>high(longint)) then
|
||||
Message(parser_e_enumeration_out_of_range);
|
||||
tenumsymtable(aktenumdef.symtable).insert(cenumsym.create(s,aktenumdef,longint(l.svalue)));
|
||||
if not (cs_scopedenums in current_settings.localswitches) then
|
||||
tstoredsymtable(aktenumdef.owner).insert(cenumsym.create(s,aktenumdef,longint(l.svalue)));
|
||||
|
7
tests/webtbf/tw34633.pp
Normal file
7
tests/webtbf/tw34633.pp
Normal file
@ -0,0 +1,7 @@
|
||||
{ %fail }
|
||||
{$mode delphi}
|
||||
type tenum = (b0, b1, b2, bMax = high(dword));
|
||||
|
||||
begin
|
||||
writeln(sizeof(tenum));
|
||||
end.
|
Loading…
Reference in New Issue
Block a user