Why does disabling writing to typed constants (with $J or
$WRITEABLECONST, see
http://www.freepascal.org/docs-html/prog/progsu40.html#x47-450001.1.40)
make it so i cannot use those consts as default values for const
parameters.

In other words, why does this produce an illegal expression when compiling?

===============================
program project1;

{$mode objfpc}{$H+}
{$WRITEABLECONST OFF}

type
  TestIntegerType = integer;

const
  TestIntegerZero : TestIntegerType = 0;
  TestIntegerOne : TestIntegerType = 1;

procedure AcceptTestInteger(const val : TestIntegerType = TestIntegerZero);
begin
end;

begin
  AcceptTestInteger();
end.
===============================

I don't see why that's al illegal expression. Is this a compiler bug?
If not, can someone explain to me why this is not allowed?

Thanks,

-SG

--
This email is fiction. Any resemblance to actual events
or persons living or dead is purely coincidental.

Seth Grover
sethdgrover[at]gmail[dot]com
_______________________________________________
fpc-devel maillist  -  [email protected]
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to