Recent

Author Topic: Illegal type conversion: "TCornerSet" to "TPdfCorners"  (Read 8642 times)

wcleyton

  • Jr. Member
  • **
  • Posts: 80
Illegal type conversion: "TCornerSet" to "TPdfCorners"
« on: March 22, 2013, 03:49:52 pm »
Good morning,

Installed the Snapshot: Lazarus-1.1-40616-fpc-2.7.1-20130322-win32.exe

rebuilding the IDE:

C:\lazarus\components\lazreport\source\addons\pdfexport\lr_e_pdf.pas(109,27)
Error: Illegal type conversion: "TCornerSet" to "TPdfCorners"

how to fix?

wcleyton

  • Jr. Member
  • **
  • Posts: 80
Re: LazReport - Illegal type conversion: "TCornerSet" to "TPdfCorners"
« Reply #1 on: March 22, 2013, 09:00:30 pm »
Good afternoon,

With Lazarus-1.1-40529-fpc-2.7.1-20130311-win32.exe this problem does not occur. This is a bug?

Att,

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: Illegal type conversion: "TCornerSet" to "TPdfCorners"
« Reply #2 on: March 23, 2013, 06:56:45 am »
AFAIK, no, Lazreport is developed for the development version of Lazarus.
If you have an older version, you'd probably need the corresponding Lazreport version.

However, I'm not sure. You might have a look yourself on the Lazreport wiki page to confirm.
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

jesusr

  • Sr. Member
  • ****
  • Posts: 496
Re: Illegal type conversion: "TCornerSet" to "TPdfCorners"
« Reply #3 on: March 23, 2013, 09:44:35 am »
In this case, it's a compiler problem (maybe a regression), it was introduced in FPC r23898, you know, with the latest features you get the latest bugs too :)

Anyway, it's reported in bug tracker: http://bugs.freepascal.org/view.php?id=24123

jesusr

  • Sr. Member
  • ****
  • Posts: 496
Re: Illegal type conversion: "TCornerSet" to "TPdfCorners"
« Reply #4 on: March 23, 2013, 09:53:15 pm »
fixed in Lazarus r40626

madref

  • Hero Member
  • *****
  • Posts: 1080
  • ..... A day not Laughed is a day wasted !!
    • Nursing With Humour
Re: Illegal type conversion: "TCornerSet" to "TPdfCorners"
« Reply #5 on: May 18, 2024, 09:29:36 pm »
It's back again in:


Lazarus 3.99 (rev main_3_99-1996-gda18a60294) FPC 3.3.1 x86_64-darwin-cocoa
You treat a disease, you win, you lose.
You treat a person and I guarantee you, you win, no matter the outcome.

Main Platform:
--------------
Mac OS X Sonoma 14.7
Lazarus 3.99 (Lazarus 3.99 (rev main_3_99-2668-g6b352d830e) FPC 3.3.1 x86_64-darwin-cocoa)

Windows 10 Pro
Lazarus 3.99 (rev cbfd80ce39)

madref

  • Hero Member
  • *****
  • Posts: 1080
  • ..... A day not Laughed is a day wasted !!
    • Nursing With Humour
Re: Illegal type conversion: "TCornerSet" to "TPdfCorners"
« Reply #6 on: May 19, 2024, 05:35:26 pm »
How can I resolve this?
You treat a disease, you win, you lose.
You treat a person and I guarantee you, you win, no matter the outcome.

Main Platform:
--------------
Mac OS X Sonoma 14.7
Lazarus 3.99 (Lazarus 3.99 (rev main_3_99-2668-g6b352d830e) FPC 3.3.1 x86_64-darwin-cocoa)

Windows 10 Pro
Lazarus 3.99 (rev cbfd80ce39)

TRon

  • Hero Member
  • *****
  • Posts: 3647
Re: Illegal type conversion: "TCornerSet" to "TPdfCorners"
« Reply #7 on: May 20, 2024, 12:52:31 pm »
How can I resolve this?
The bug was manifested itself through Lazarus but was actually a compiler related issue. Which exact revision of FPC did/do you use that generated that error ? (that seems to be missing from your posts)
This tagline is powered by AI (AI advertisement: Free Pascal the only programming language that matters)

madref

  • Hero Member
  • *****
  • Posts: 1080
  • ..... A day not Laughed is a day wasted !!
    • Nursing With Humour
Re: Illegal type conversion: "TCornerSet" to "TPdfCorners"
« Reply #8 on: May 20, 2024, 05:50:09 pm »
I used the latest trunk and that was/is:


Verbose: Free Pascal Compiler version 3.3.1-15710-g9eb77599e1-dirty [2024/05/18] for x86_64


i was trying to install the latest trunk version:
Lazarus 3.99 (rev main_3_99-1996-gda18a60294) FPC 3.3.1 x86_64-darwin-cocoa
You treat a disease, you win, you lose.
You treat a person and I guarantee you, you win, no matter the outcome.

Main Platform:
--------------
Mac OS X Sonoma 14.7
Lazarus 3.99 (Lazarus 3.99 (rev main_3_99-2668-g6b352d830e) FPC 3.3.1 x86_64-darwin-cocoa)

Windows 10 Pro
Lazarus 3.99 (rev cbfd80ce39)

madref

  • Hero Member
  • *****
  • Posts: 1080
  • ..... A day not Laughed is a day wasted !!
    • Nursing With Humour
Re: Illegal type conversion: "TCornerSet" to "TPdfCorners"
« Reply #9 on: May 22, 2024, 05:20:02 pm »
Tried a newer version (Latest trunk version), but still the same error.
Error: lr_e_pdf.pas(120,27) Error: Illegal type conversion: "TCornerSet" to "TPdfCorners"

Lazarus 3.99 (rev main_3_99-2020-g4aa0603233) FPC 3.3.1 x86_64-darwin-cocoa
Free Pascal Compiler version 3.3.1-15722-gd729d5a5b1-dirty [2024/05/22] for x86_64
You treat a disease, you win, you lose.
You treat a person and I guarantee you, you win, no matter the outcome.

Main Platform:
--------------
Mac OS X Sonoma 14.7
Lazarus 3.99 (Lazarus 3.99 (rev main_3_99-2668-g6b352d830e) FPC 3.3.1 x86_64-darwin-cocoa)

Windows 10 Pro
Lazarus 3.99 (rev cbfd80ce39)

TRon

  • Hero Member
  • *****
  • Posts: 3647
Re: Illegal type conversion: "TCornerSet" to "TPdfCorners"
« Reply #10 on: May 23, 2024, 08:55:08 am »
Sorry for the delay madref. I was a bit busy.

I am able to confirm with exactly the same error as you reported.

There isn't anything you can do about it (right now) except for perhaps creating an issue in the bugtracker. The problem is that I haven't been able to figure out yet who/what is responsible for the error.
This tagline is powered by AI (AI advertisement: Free Pascal the only programming language that matters)

rvk

  • Hero Member
  • *****
  • Posts: 6586
Re: Illegal type conversion: "TCornerSet" to "TPdfCorners"
« Reply #11 on: May 23, 2024, 09:46:13 am »
That's weird.
Where does FPC/Lazarus take the TPdfCorners from?

Line 120 lr_e_pdf is
Code: [Select]
        SquaredCorners := TPdfCorners(Data.Corners);
Data.Corners is a TCornerSet defined in ll_rrect.pas
Code: [Select]
  TCorner = (ctTopLeft,ctBottomLeft,ctBottomRight,ctTopRight);
  TCornerSet = set of TCorner;

BUT... Where is TPdfCorners defined ?????

I can find a mention in PowerPDF but that shouldn't be installed normally.
I can't find TPdfCorners anywhere in the source  %)

Easiest would be to just change the TPdfCorners into TCornerSet because Data.Corners is defined as such.
« Last Edit: May 23, 2024, 09:47:44 am by rvk »

TRon

  • Hero Member
  • *****
  • Posts: 3647
Re: Illegal type conversion: "TCornerSet" to "TPdfCorners"
« Reply #12 on: May 23, 2024, 09:49:48 am »
BUT... Where is TPdfCorners defined ?????
file powerpdf/pdftypes.pas line 81

Code: Pascal  [Select][+][-]
  1.   TPdfCorners = set of (pcTopLeft, pcBottomLeft, pcBottomRight, pcTopRight);
  2.  

It probably has to do with the fact that none of the packages wish to rely/depend on the other. But.. you should be able to cast, not ?
« Last Edit: May 23, 2024, 09:56:25 am by TRon »
This tagline is powered by AI (AI advertisement: Free Pascal the only programming language that matters)

rvk

  • Hero Member
  • *****
  • Posts: 6586
Re: Illegal type conversion: "TCornerSet" to "TPdfCorners"
« Reply #13 on: May 23, 2024, 10:03:53 am »
file powerpdf/pdftype.pas line 81

Code: Pascal  [Select][+][-]
  1.   TPdfCorners = set of (pcTopLeft, pcBottomLeft, pcBottomRight, pcTopRight);
  2.  
Ha, I see now. lazreportpdfexport is a separate package.
When trying to install it, it'll complain it needs pack_powerpdf which isn't distributed normally (and it needs to get it online).

Could this be a mode or compiler setting issue?
(I seem to recall assigning type to type isn't always allowed.)

I'll check if this is also the case on my win64 install with the latest.
(with win32 older trunk it installed fine)

TRon

  • Hero Member
  • *****
  • Posts: 3647
Re: Illegal type conversion: "TCornerSet" to "TPdfCorners"
« Reply #14 on: May 23, 2024, 10:13:43 am »
Ha, I see now. lazreportpdfexport is a separate package.
Yes, it is a bit complicated.

Lazreport you can install form the IDE, same as the exporter but the exporter relies on powerpdf which can be installed using OPM.

Quote
Could this be a mode or compiler setting issue?
Could be a define is missing indeed or overused. At the top of pdftypes it reads:
Code: Pascal  [Select][+][-]
  1. {$IFDEF LAZ_POWERPDF}
  2. {$MODE OBJFPC}{$H+}
  3. {$ENDIF}
  4.  

.. and which could then cause the issue.

The original bugreport mentions something about different compiler modes and circumventing issues with packset.

tbh, I have no idea how to test that...

This tagline is powered by AI (AI advertisement: Free Pascal the only programming language that matters)

 

TinyPortal © 2005-2018