[fpc-pascal] Incompatible types: got "SYSTEM.PChar" expected "SYSTEM.PChar"
joshyfun at gmail.com
Thu Jun 9 00:04:29 CEST 2016
I have a lot of constant strings and some array of records that should
be initialized in one field with one of this entries, so I found two
solutions, one is create a symbol for each string, something like:
But also I need to be able to enumerate all of them at runtime, so I
wrote an array and initialize it at compile time (this also produces
less symbol pollution for the compiler):
TMyStrings: array [0..1] of pchar = (
'String One','String Two');
As I need this names in other places I try to create a record and
initialize it at runtime using the pchar of the previous array, and here
is the problem:
TSomePcharArray: array [0..1] of pchar = ( 'pcharONE','pcharTWO');
TConstRecord: TFirstRecord = (
This does not compile and outputs the funny error in the subject. I
think it should compile as information is static and previously defined,
but if it is indeed an error by my side maybe the error message should
be a bit different :-?
To test the example, define or undefine the "THISDONTCOMPILE", with it
defined it does not compile, without it it compiles and the modified
writeln shows the expected pchar string.
Should I report it ?
More information about the fpc-pascal