Re: [fpc-devel] Error: Global Generic template references static symtable

2021-01-11 Thread Sven Barth via fpc-devel
Bart via fpc-devel  schrieb am Mo., 11.
Jan. 2021, 03:42:

> On Sun, Jan 10, 2021 at 11:59 AM Sven Barth via fpc-devel
>  wrote:
>
> > Displaying the message at the correct location would be more involved...
> > you might want to open a bug report for that so that it's remembered
> > somewhere, but it's definitely going to be a low priority one.
>
> https://bugs.freepascal.org/view.php?id=38342


Thanks.

Regards,
Sven

>
>
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] Error: Global Generic template references static symtable

2021-01-10 Thread Bart via fpc-devel
On Sun, Jan 10, 2021 at 11:59 AM Sven Barth via fpc-devel
 wrote:

> Displaying the message at the correct location would be more involved...
> you might want to open a bug report for that so that it's remembered
> somewhere, but it's definitely going to be a low priority one.

https://bugs.freepascal.org/view.php?id=38342

-- 
Bart
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] Error: Global Generic template references static symtable

2021-01-10 Thread Sven Barth via fpc-devel

Am 09.01.2021 um 16:21 schrieb Bart via fpc-devel:



The *why* is not important for users. Those that are interested can ask, just 
like you did.

Then let me rephrase it.
Error messages of the compiler normally point you in the right direction like:
   qtest.lpr(367,3) Fatal: Syntax error, ";" expected but "identifier
TESTINCCAP" found
It's sort of obvious there is a missing semicolon.

OTOH: "Global Generic template references static symtable" only means
something to me (as an fpc user) if I know what a static symtable is
(I assume this is an internal datastructure in the compiler).
Since I have no clue, I have absolutely no idea how to fix that error.
In my case I commented out all lines in the given procedure and
uncommented them one by one to finally get at the offending line in
question.
I then made an educated guess that (sine accessing functions like
Format() is OK), it must have something to do with the declaration of
the "Min()" function.

It would have helped if the error message was a little less cryptic,
and/or if it pointed to the line that caused the error in the first
place.

I have clarified the message a bit.

Displaying the message at the correct location would be more involved... 
you might want to open a bug report for that so that it's remembered 
somewhere, but it's definitely going to be a low priority one.


Regards,
Sven
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] Error: Global Generic template references static symtable

2021-01-09 Thread Bart via fpc-devel
On Sat, Jan 9, 2021 at 12:00 PM Sven Barth via fpc-devel
 wrote:

> Right click the error message in Lazarus, then click "Help". For me a dialog 
> with the following text appeared:
Hah!
Learned something new today!

> The *why* is not important for users. Those that are interested can ask, just 
> like you did.

Then let me rephrase it.
Error messages of the compiler normally point you in the right direction like:
  qtest.lpr(367,3) Fatal: Syntax error, ";" expected but "identifier
TESTINCCAP" found
It's sort of obvious there is a missing semicolon.

OTOH: "Global Generic template references static symtable" only means
something to me (as an fpc user) if I know what a static symtable is
(I assume this is an internal datastructure in the compiler).
Since I have no clue, I have absolutely no idea how to fix that error.
In my case I commented out all lines in the given procedure and
uncommented them one by one to finally get at the offending line in
question.
I then made an educated guess that (sine accessing functions like
Format() is OK), it must have something to do with the declaration of
the "Min()" function.

It would have helped if the error message was a little less cryptic,
and/or if it pointed to the line that caused the error in the first
place.

Of course I have no idea wether or not this error message only applies
to the situation I encountered...

Bart



-- 
Bart
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] Error: Global Generic template references static symtable

2021-01-09 Thread Sven Barth via fpc-devel
Bart via fpc-devel  schrieb am Sa., 9. Jan.
2021, 05:17:

> On Fri, Jan 8, 2021 at 9:00 PM Sven Barth via fpc-devel
>  wrote:
>
> >> It seems I cannot use a stand-alone function that is declared in the
> >> implementation of the unit?
>
> > Generics are a stream of tokens that is reparsed when specialized.
> Functions declared in the implementation section are simply not available
> then thus its forbidden right away. This is Delphi compatible.
>
> Thanks for explaining this.
> The errormessage is probably technically correct, but for me it might
> be a little more informative (so that I can tell what I did wrong).
>

Right click the error message in Lazarus, then click "Help". For me a
dialog with the following text appeared:

"A generic declared in the interface section of a unit must not reference
symbols that belong solely to the implementation section of that unit."

The *why* is not important for users. Those that are interested can ask,
just like you did.

Regards,
Sven

>
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] Error: Global Generic template references static symtable

2021-01-08 Thread Bart via fpc-devel
On Fri, Jan 8, 2021 at 9:00 PM Sven Barth via fpc-devel
 wrote:

>> It seems I cannot use a stand-alone function that is declared in the
>> implementation of the unit?

> Generics are a stream of tokens that is reparsed when specialized. Functions 
> declared in the implementation section are simply not available then thus its 
> forbidden right away. This is Delphi compatible.

Thanks for explaining this.
The errormessage is probably technically correct, but for me it might
be a little more informative (so that I can tell what I did wrong).

-- 
Bart
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] Error: Global Generic template references static symtable

2021-01-08 Thread Sven Barth via fpc-devel
Bart via fpc-devel  schrieb am Fr., 8. Jan.
2021, 20:07:

> It seems I cannot use a stand-alone function that is declared in the
> implementation of the unit?
>

Correct.

Why is that?
>

Generics are a stream of tokens that is reparsed when specialized.
Functions declared in the implementation section are simply not available
then thus its forbidden right away. This is Delphi compatible.

Regards,
Sven

>
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


[fpc-devel] Error: Global Generic template references static symtable

2021-01-08 Thread Bart via fpc-devel
Hi,

While trying to solve https://bugs.freepascal.org/view.php?id=38306 I
got this error I have never seen before.

_gdeque.pp(249,4) Error: Global Generic template references static symtable
_gdeque.pp(302) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted

Line 249 is the "end;" of a method (IncreaseCapacity) of a generic class.

If I remove this line the error goes away:

Elems := Min(EmptyElems, FStart);
Elems and EmptyElems are local vars to that method.
FStart is a private variable of the class.

function Min(const A,B: SizeUInt): SizeUInt;  //no need to drag in the
entire Math unit ;-)
begin
  if (Ahttps://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel