Sign in Join

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

Mailing lists / fpc-devel / 2012-04

Problem with nested classes and const struct values

13 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

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

Andrew Brunner

This problem recently appeared in svn/fpc/trunk

I tried pointing to:

  CLSInfo : @Root.Test.CLSInfo ; // Still not working
  CLSInfo : @Root.Test.CLSInfo1 ;// Renamed dec and still didn't work.

This problem did not exist a few days ago.
I have a ton of units that don't compile now!!!

Please help.

fpc ./Test.lpr
Free Pascal Compiler version 2.7.1 [2012/04/30] for x86_64 Copyright (c) 1993-2012 by Florian Klaempfl and others Target OS: Linux for x86-64
Compiling ./Test.lpr
Test.lpr(65,43) Error: Illegal expression
Test.lpr(65,36) Error: Incompatible types: got "Pointer" expected "PCLSInfo" Test.lpr(65,43) Error: Illegal expression
Test.lpr(66,36) Error: Incompatible types: got "Pointer" expected "PACLInfo" Test.lpr(66,43) Error: Illegal expression
Test.lpr(73) Fatal: There were 5 errors compiling module, stopping Fatal: Compilation aborted

Reply by email

Jonas Maebe
to Andrew Brunner

Andrew Brunner wrote on Mon, 30 Apr 2012:

Show quoted text 11 lines
This problem recently appeared in svn/fpc/trunk I tried pointing to: CLSInfo : @Root.Test.CLSInfo ; // Still not working CLSInfo : @Root.Test.CLSInfo1 ;// Renamed dec and still didn't work. This problem did not exist a few days ago. I have a ton of units that don't compile now!!! Please help.

You attached the .lpi instead of the .lpr file.

Jonas

Reply by email

Andrew Brunner
to Jonas Maebe

Well,

The problem started when I did a fresh install of Ubuntu 12.04. The main project that uses similar code to my attached test had FPC raise the same error but with similar code.
Presently, a fresh build of FPC and Lazarus allows me to build my big project however, the test project still won't build with

Compiling ./Test.lpr
Test.lpr(65,36) Error: Incompatible types: got "Pointer" expected "PCLSInfo"
Test.lpr(65,44) Error: Illegal expression
Test.lpr(66,36) Error: Incompatible types: got "Pointer" expected "PACLInfo"
Test.lpr(66,44) Error: Illegal expression
Test.lpr(73) Fatal: There were 4 errors compiling module, stopping
Fatal: Compilation aborted

But yet my big project with very complex nested declarations compiles just fine
<snip>
unit coAdmin;

interface
  uses hTimer,hHTTP,hHTTPd,hRSR,uRSR,Classes,uCoreObjects,uKeywords,
    hSRConsts,uTimer,uStringArray,uVarString,uKPList,hDateUtils,uFileUtils,
dbmDomains,dbmCoreObjects,dbmUserAccounts,dbmRSS,dbmCalendaring,hDatabase;
Type
  ns=class
  Type
    Admin=class
    const
      XMLInf:TXMLInfo=(
        Enabled                  : false;
      );
      ACLInf:TACLInfo=(
        Name                     : 'Admin';
        NameSpace                : '/core/admin';
        Caption                  : 'Administration Core Object';
        Prompt                   : 'User can access administration
dashboard';
        Description              : 'Back-end system administration handler'
      );
      CLSInf:TCLSInfo=(
        Name                     : 'TAdminCore';
        Location                 : 'coAdmin.pas';
      );
      Header:TCoreObjectInfo=(
        ID                       : 0;
        ProviderID               : 0;
        Enabled                  : true;
        Anonymous                : false;
        NotifyOnBuffersChanged   : false;
        Scale                    : 0;
        CLSInfo                  : @CLSInf;
        ACLInfo                  : @ACLInf;
      );
    <snip of more of these types of declarations>
Jonas Maebe wrote 13 lines
On 30 Apr 2012, at 16:48, Andrew Brunner wrote: > This problem did not exist a few days ago. Can you be more precise? I just checked with trunk from before the jvmbackend merge (which is from Thursday), and that one also gives an error. Jonas_______________________________________________ fpc-devel maillist - http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply by email

Flávio Etrusco
to Andrew Brunner

FWIW FPC 2.6.0 also triggers the same error. AFAICS this problem is somewhat analogous to the limitation when declaring members in a record. Are you sure the unit in your big project is being compiled?

-Flávio

Andrew Brunner wrote 82 lines
Well, The problem started when I did a fresh install of Ubuntu 12.04. The main project that uses similar code to my attached test had FPC raise the same error but with similar code. Presently, a fresh build of FPC and Lazarus allows me to build my big project however, the test project still won't build with Compiling ./Test.lpr Test.lpr(65,36) Error: Incompatible types: got "Pointer" expected "PCLSInfo" Test.lpr(65,44) Error: Illegal expression Test.lpr(66,36) Error: Incompatible types: got "Pointer" expected "PACLInfo" Test.lpr(66,44) Error: Illegal expression Test.lpr(73) Fatal: There were 4 errors compiling module, stopping Fatal: Compilation aborted But yet my big project with very complex nested declarations compiles just fine <snip> unit coAdmin; interface   uses hTimer,hHTTP,hHTTPd,hRSR,uRSR,Classes,uCoreObjects,uKeywords,     hSRConsts,uTimer,uStringArray,uVarString,uKPList,hDateUtils,uFileUtils, dbmDomains,dbmCoreObjects,dbmUserAccounts,dbmRSS,dbmCalendaring,hDatabase; Type   ns=class   Type     Admin=class     const       XMLInf:TXMLInfo=(         Enabled                  : false;       );       ACLInf:TACLInfo=(         Name                     : 'Admin';         NameSpace                : '/core/admin';         Caption                  : 'Administration Core Object';         Prompt                   : 'User can access administration dashboard';         Description              : 'Back-end system administration handler'       );       CLSInf:TCLSInfo=(         Name                     : 'TAdminCore';         Location                 : 'coAdmin.pas';       );       Header:TCoreObjectInfo=(         ID                       : 0;         ProviderID               : 0;         Enabled                  : true;         Anonymous                : false;         NotifyOnBuffersChanged   : false;         Scale                    : 0;         CLSInfo                  : @CLSInf;         ACLInfo                  : @ACLInf;       );     <snip of more of these types of declarations> On Mon, Apr 30, 2012 at 1:12 PM, Jonas Maebe wrote: > > > On 30 Apr 2012, at 16:48, Andrew Brunner wrote: > > > This problem did not exist a few days ago. > > Can you be more precise? I just checked with trunk from before the > jvmbackend merge (which is from Thursday), and that one also gives an error. > > > Jonas_______________________________________________ > fpc-devel maillist  -   > http://lists.freepascal.org/mailman/listinfo/fpc-devel _______________________________________________ fpc-devel maillist  -   http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply by email

Andrew Brunner
to Flávio Etrusco

Yes. I'm completely sure it's working now. But i can't figure out why the small project doesn't. I even tried to make clean for my big project to see if I could make it not work.. but it compiles now.

Flávio Etrusco wrote 101 lines
FWIW FPC 2.6.0 also triggers the same error. AFAICS this problem is somewhat analogous to the limitation when declaring members in a record. Are you sure the unit in your big project is being compiled? -Flávio On Mon, Apr 30, 2012 at 3:39 PM, Andrew Brunner wrote: > Well, > > The problem started when I did a fresh install of Ubuntu 12.04. > The main project that uses similar code to my attached test had FPC raise > the same error but with similar code. > Presently, a fresh build of FPC and Lazarus allows me to build my big > project however, the test project still won't build with > > Compiling ./Test.lpr > Test.lpr(65,36) Error: Incompatible types: got "Pointer" expected "PCLSInfo" > Test.lpr(65,44) Error: Illegal expression > Test.lpr(66,36) Error: Incompatible types: got "Pointer" expected "PACLInfo" > Test.lpr(66,44) Error: Illegal expression > Test.lpr(73) Fatal: There were 4 errors compiling module, stopping > Fatal: Compilation aborted > > But yet my big project with very complex nested declarations compiles just > fine > <snip> > unit coAdmin; > > interface > uses hTimer,hHTTP,hHTTPd,hRSR,uRSR,Classes,uCoreObjects,uKeywords, > hSRConsts,uTimer,uStringArray,uVarString,uKPList,hDateUtils,uFileUtils, > > dbmDomains,dbmCoreObjects,dbmUserAccounts,dbmRSS,dbmCalendaring,hDatabase; > > Type > ns=class > Type > Admin=class > const > XMLInf:TXMLInfo=( > Enabled : false; > ); > ACLInf:TACLInfo=( > Name : 'Admin'; > NameSpace : '/core/admin'; > Caption : 'Administration Core Object'; > Prompt : 'User can access administration > dashboard'; > Description : 'Back-end system administration handler' > ); > CLSInf:TCLSInfo=( > Name : 'TAdminCore'; > Location : 'coAdmin.pas'; > ); > Header:TCoreObjectInfo=( > ID : 0; > ProviderID : 0; > Enabled : true; > Anonymous : false; > NotifyOnBuffersChanged : false; > Scale : 0; > CLSInfo : @CLSInf; > ACLInfo : @ACLInf; > ); > <snip of more of these types of declarations> > > > On Mon, Apr 30, 2012 at 1:12 PM, Jonas Maebe > wrote: >> >> >> On 30 Apr 2012, at 16:48, Andrew Brunner wrote: >> >> > This problem did not exist a few days ago. >> >> Can you be more precise? I just checked with trunk from before the >> jvmbackend merge (which is from Thursday), and that one also gives an error. >> >> >> Jonas_______________________________________________ >> fpc-devel maillist - >> http://lists.freepascal.org/mailman/listinfo/fpc-devel > > > > _______________________________________________ > fpc-devel maillist - > http://lists.freepascal.org/mailman/listinfo/fpc-devel > _______________________________________________ fpc-devel maillist - http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply by email

Andrew Brunner
to Andrew Brunner: This problem recently appeared in svn/fpc/trunk I tried pointing to: CLSInfo :…

Ok,

Attached is a sample program that demonstrates the problem.

FPC 2.6.0 compiles just fine.
FPC Trunk has a problem.

The attachment of the unit in this thread prior SHOULD work but did not because there is a secondary problem in that once I moved the primary decs into a header file the using unit was able to compile in 2.6 but not 2.7.

Adding the contents of hTest to the project's types will make the make FPC 2.6 and 2.7 not compile.

I need 2.7 to compile with nested classes. You can fix the secondary problem if you want.. but I absolutely need 2.7 to compile the newly attached project.

Thanks

Reply by email

Paul Ishenin
to Andrew Brunner
Andrew Brunner wrote 6 lines
Ok, Attached is a sample program that demonstrates the problem. FPC 2.6.0 compiles just fine. FPC Trunk has a problem.

Probably this happen because of some bug fix because I have the same error in delphi:

htest.pas(44)
Test.lpr(41) Error: E2003 Undeclared identifier: 'CLSInfo' Test.lpr(42) Error: E2003 Undeclared identifier: 'ACLInfo' Test.lpr(49)

Best regards,
Paul Ishenin

Reply by email

Paul Ishenin
to Paul Ishenin
Paul Ishenin wrote 7 lines
Probably this happen because of some bug fix because I have the same error in delphi: htest.pas(44) Test.lpr(41) Error: E2003 Undeclared identifier: 'CLSInfo' Test.lpr(42) Error: E2003 Undeclared identifier: 'ACLInfo' Test.lpr(49)

Although if I change your sources to:

       Header:TCoreObjectInfo=(
         ID                       : 0;
         ProviderID               : 0;
         Enabled                  : true;
         Anonymous                : false;
         NotifyOnBuffersChanged   : false;
         Scale                    : 0;
         CLSInfo                  : @Root.Test.CLSInfo;
         ACLInfo                  : @Root.Test.ACLInfo;
       );

then delphi start to compile while FPC still does not.

Best regards,
Paul Ishenin

Reply by email