On Sat, Jul 6, 2019 at 9:10 AM Ryan Joseph <[email protected]> wrote:
> Btw, here is the "Illegal expression” error which I mentioned before but
> lost track of.
>
> ==========
>
> {$mode objfpc}
>
> program test;
>
> const lines: ansistring = `
> #version 150
>
> uniform sampler2D textures[8];
> in vec2 vertexTexCoord;
> in vec4 vertexColor;
> in float vertexUVMap;
> out vec4 fragColor;
>
> void main()
> {
> if (vertexUVMap == 255) {
> fragColor = vertexColor;
> } else {
> fragColor = texture(textures[int(vertexUVMap)], vertexTexCoord.st);
> if (vertexColor.a < fragColor.a) {
> fragColor.a = vertexColor.a;
> }
> }
>
> // TODO: testing
> fragColor = vec4(1,0,0,1);
> }
> `;
>
> var
> s: ansistring = lines;
> begin
> writeln(lines);
> end.
>
> Regards,
> Ryan Joseph
>
That really is an illegal expression (I.E. once again expected behavior)
whether multi-line strings are involved or not. The following is equally
invalid:
{$mode objfpc}
program test;
const lines: ansistring = 'just a single line string';
var
s: ansistring = lines;
begin
writeln(lines);
end.
You cannot under any circumstances initialize a variable with a "typed"
constant, because typed constants are themselves mutable by default.
_______________________________________________
fpc-devel maillist - [email protected]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel