Skip to content
GitLab
    • GitLab: the DevOps platform
    • Explore GitLab
    • Install GitLab
    • How GitLab compares
    • Get started
    • GitLab docs
    • GitLab Learn
  • Pricing
  • Talk to an expert
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
    • Switch to GitLab Next
    Projects Groups Snippets
  • Sign up now
  • Login
  • Sign in / Register
  • FPC Source FPC Source
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Graph
    • Compare
    • Locked Files
  • Issues 1,357
    • Issues 1,357
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 73
    • Merge requests 73
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • FPC
  • FPCFPC
  • FPC SourceFPC Source
  • Issues
  • #39935
Closed
Open
Issue created Oct 01, 2022 by bogen85@bogen85

PParser fails on a record with strict private

Summary

System Information

  • 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

Got:

+ /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

Example Project

What is the current bug behavior?

See steps to reproduce. PParser fails on a record with strict private

What is the expected (correct) behavior?

For PParser to parse the line in question...

As the program in question compiles and runs fine.

Source:

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

Related

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)

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking