View Issue Details

IDProjectCategoryView StatusLast Update
0034054FPCCompilerpublic2020-09-23 22:25
ReporterThaddy de Koning Assigned ToFlorian  
Status resolvedResolutionfixed 
Product Version3.1.1 
Fixed in Version3.3.1 
Summary0034054: assignment of typed const pointer types have correct but cryptic error message.
Descriptiontyped consts of a pointer type can not be assigned to eachother at compile time for the following reasons:
1. Typed consts have a memory location. They are actually a restricted type of var.
2. The two pointer types p and b of type PWideChar therefor are each a different memory address.
3. Typed consts do not have copy semantics for pointer types at declaration time:the address b can not be the address p.

But the error message is rather cryptic. Maybe this can be improved somewhat, like "Error: Typed consts of pointer types can not be assigned to each other at declaration time."
Steps To Reproduceprogram PwidecharIssue;
  test :array[0..0] of PWidechar = ('some value');
  p: pwidechar = @test[0];
  b: pwidechar = p;
  // Error: Incompatible types: got "SYSTEM.PWideChar" expected "SYSTEM.PWideChar"
  // This is indeed correct (p and b are different pointers) but cryptic
Additional InformationMaybe also needs an update of the documentation.
TagsNo tags attached.
Fixed in Revision46931
Attached Files


Thaddy de Koning

2018-07-30 18:22

reporter   ~0109770

Compile time should read declaration time. They can be assigned each other's content when processing, but not when declared. That behavior is correct.


2020-09-23 22:25

administrator   ~0125796

Compiler will just throw an illegal expression error now.

Issue History

Date Modified Username Field Change
2018-07-30 08:29 Thaddy de Koning New Issue
2018-07-30 18:22 Thaddy de Koning Note Added: 0109770
2020-09-23 22:25 Florian Assigned To => Florian
2020-09-23 22:25 Florian Status new => resolved
2020-09-23 22:25 Florian Resolution open => fixed
2020-09-23 22:25 Florian Fixed in Version => 3.3.1
2020-09-23 22:25 Florian Fixed in Revision => 46931
2020-09-23 22:25 Florian FPCTarget => -
2020-09-23 22:25 Florian Note Added: 0125796