PParser fails on a record with strict private
- Operating system: Linux, Arch Linux
- Processor architecture: x86_64
- Compiler version: 3.3.1-11945-g0a9e1ede
- Device: Computer
Steps to reproduce
See attached program: lazforum-60775b.tar.gz
make clean make x_parse_pas3
+ /home/shared-development/lazforum/60775.b/bin/parse_pas strictprivate.pas An unhandled exception occurred at $0000000000461E52: EParserError: Expected "," or ":" at token "Identifier private" in file strictprivate.pas at line 5 column 10 $0000000000461E52 $0000000000461CE6 $00000000004027A7 main, line 122 of parse_pas.paGoodbye TSimpleEngine TObjectWrapC<T>.destroy release ptr: 0000000000000000 s $0000000000402BDE $main, line 127 of parse_pas.pas
What is the current bug behavior?
See steps to reproduce. PParser fails on a record with
What is the expected (correct) behavior?
For PParser to parse the line in question...
As the program in question compiles and runs fine.
program strictprivate; type tStrictPrivate = record strict private a: integer; public property b: integer read a write a; end; var c: tStrictPrivate; begin c.b := 4; writeln ('c.b: ', c.b); c.b := 5; writeln ('c.b: ', c.b); end.
Compiling and running:
$ make strictprivate [/home/shared-development/lazforum/60775.b/bin/strictprivate] + /home/shared-development/fpc_usr/bin/fpc -Fu. -Xc -XD -Xi -Sm -Sg -Os -gl -Sd -vnewh -Senwh -Sh -FE/home/shared-development/lazforum/60775.b/bin strictprivate.pas Hint: Start of reading config file /home/shared-development/fpc_usr/lib/fpc/etc/fpc.cfg Hint: End of reading config file /home/shared-development/fpc_usr/lib/fpc/etc/fpc.cfg Free Pascal Compiler version 3.3.1 [2022/10/01] for x86_64 Copyright (c) 1993-2022 by Florian Klaempfl and others Target OS: Linux for x86-64 Compiling strictprivate.pas Linking /home/shared-development/lazforum/60775.b/bin/strictprivate 19 lines compiled, 0.1 sec, 156768 bytes code, 1139864 bytes data 2 hint(s) issued real 0m0.126s user 0m0.067s sys 0m0.057s + echo '[/home/shared-development/lazforum/60775.b/bin/strictprivate]' [/home/shared-development/lazforum/60775.b/bin/strictprivate] + set -xeuo pipefail [strictprivate] + /home/shared-development/lazforum/60775.b/bin/strictprivate c.b: 4 c.b: 5
And the following works:
make clean make x_parse_pas2
See this Lazarus forum post Topic: PParser failes on "strict private" and types containing function references for more information on this.
Also see #39931 (closed)