Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2011-09

Syntax error with new FPC SVN

4 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

fred f

Hi guys,

I have updated my FPC to SVN from today and when I try to compile my old code working with 2.5.1 from June writes:

TYPE TByteSet = set of Byte(0)..Byte(7);
> Fatal: Syntax error, ";" expected but "(" found

What has changed on syntax for this definition?

PS: I use {$MODE Delphi} switch.

Thanx, ff.

Reply by email

Jonas Maebe
to fred f
fred f wrote 10 lines
I have updated my FPC to SVN from today and when I try to compile my old code working with 2.5.1 from June writes: TYPE TByteSet = set of Byte(0)..Byte(7); >> Fatal: Syntax error, ";" expected but "(" found What has changed on syntax for this definition? PS: I use {$MODE Delphi} switch.

It's the byte() typecasts that trigger the error message, but that's definitely quite a serious bug. Please file a bug report at http://bugs.freepascal.org so it doesn't get forgotten.

Thanks,

Jonas

Reply by email

Paul Ishenin
to Jonas Maebe
Jonas Maebe wrote 14 lines
> old code working with 2.5.1 from June writes: > > TYPE TByteSet = set of Byte(0)..Byte(7); > >>> Fatal: Syntax error, ";" expected but "(" found > > What has changed on syntax for this definition? > > PS: I use {$MODE Delphi} switch. I have updated my FPC to SVN from today and when I try to compile my It's the byte() typecasts that trigger the error message, but that's definitely quite a serious bug. Please file a bug report at http://bugs.freepascal.org so it doesn't get forgotten.

This is probably my fault although:
1. delphi does not support such declarations
2. we don't have a test for this kind of syntax

So maybe we had a feature by accident? Should I restore that behavior?

Best regards,
Paul Ishenin.

Reply by email

Jonas Maebe
to Paul Ishenin
Paul Ishenin wrote 5 lines
This is probably my fault although: 1. delphi does not support such declarations 2. we don't have a test for this kind of syntax So maybe we had a feature by accident?

Set type is defined as "set of ordinal type": http://www.freepascal.org/docs-html/ref/refsu17.html

One kind of ordinal type is a subrange types, which is defined as "constant .. constant": bottom of http://www.freepascal.org/docs-html/ref/refsu5.html

Constants can include typecasts (no actual example given at http://www.freepascal.org/docs-html/ref/refse9.html , but it says that they are simply expressions which the compiler must be able to evaluate at compile time (and typecasted constants can be evaluated at compile time).

So it's documented behaviour, and it's not unclean, dangerous, etc...

Should I restore that behavior?

I think so, yes.

Jonas

Reply by email