https://gcc.gnu.org/bugzilla/show_bug.cgi?id=129175
Bug ID: 129175
Summary: ISO m2 should allow accessing a constant record during
a const declaration
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: modula2
Assignee: gaius at gcc dot gnu.org
Reporter: gaius at gcc dot gnu.org
Target Milestone: ---
Consider:
MODULE constrecord ;
FROM libc IMPORT exit ;
TYPE
rec = RECORD
first: INTEGER ;
tag : CHAR ;
END ;
CONST
dict = rec { -1, 'a' } ;
value = dict.first ;
BEGIN
IF value # -1
THEN
exit (1)
END
END constrecord.
this is allowed in ISO m2:
$ gm2 -fiso constrecord.mod
constrecord.mod:13:16: error: In program module ‘constrecord’: syntax error,
‘;’ missing
13 | value = dict.first ;
| ^
constrecord.mod:13:16: error: syntax error, found ‘.’
constrecord.mod:13:23: error: expecting one of: ‘NOT’ ‘(’ ‘__ATTRIBUTE__’ ‘{’
‘string’ ‘integer number’ ‘real number’ ‘identifier’ ‘-’ ‘+’
13 | value = dict.first ;
| ^
constrecord.mod:13:23: error: syntax error, ‘=’ missing