<p>Am 04.02.2016 05:46 schrieb "Martin" <<a href="mailto:fpc@mfriebe.de">fpc@mfriebe.de</a>>:<br>
><br>
> just found some issues<br>
><br>
> Neither syntax works in constant evaluation.<br>
> Not sure if they should, so asking here (the 2nd syntax is operator like, so kind of expected it would)<br>
><br>
> both cause an internal error trying to take the address of the returned candidate.<br>
> Then again this might not be a valid operation, but instead of internal error it should then give a more proper error.<br>
><br>
> program Project1;<br>
> {$mode objfpc}<br>
> const a = 1 + 2;<br>
> //const a = ifthen(true, 1,2);<br>
> //const a = if true then 1 else 2;<br>
> var b: integer;<br>
> var x : pointer;<br>
> begin<br>
> //x := @( if false then b else b); // internal error<br>
> //x := @( ifthen( false , b , b)); // internal error<br>
> writeln(a);<br>
> writeln(ptrint(x));<br>
> readln;<br>
> end.<br>
><br>
><br>
> Another internal error when using with the in operator.<br>
> program Project1;<br>
> {$mode objfpc}<br>
> var b: integer;<br>
> begin<br>
> b := 1;<br>
> writeln(b in [1,2] );<br>
> //writeln(b in ifthen( true , [1,2] , [3.4])); // internal error<br>
> //writeln(b in if true then [1,2] else [3.4]); // internal error<br>
> readln;<br>
> end.<br>
><br>
><br>
> And this compiles, but nothing get incremented.<br>
> If it should not work, then should it give an error?<br>
> (such as "variable identifier expected" which you get when you try to pass other not incrementable expressions )<br>
><br>
> program Project1;<br>
> {$mode objfpc}<br>
> var b: integer;<br>
> begin<br>
> b := 0;<br>
> writeln(b);<br>
> inc( if true then b else b );<br>
> writeln(b);<br>
> inc( ifthen( true ,b ,b ));<br>
> writeln(b);<br>
> readln;<br>
> end.<br>
><br>
> same with readln<br>
> readln( if true then b else b );<br>
> writeln(b);<br>
> readln( ifthen( true ,b ,b ));<br>
> writeln(b);</p>
<p>Would you please report all three of them? I don't necessarily know the best solution for problems 1 and 3, but internal errors definitely aren't the answer...</p>
<p>Regards,<br>
Sven</p>