DMD 1.011 release -- prior code does not compile

Sean Kelly sean at f4.ca
Wed Apr 11 13:08:08 PDT 2007


Walter Bright wrote:
> kris wrote:
>> Walter Bright wrote:
>>> Bug fixes, some enhancements.
>>>
>>> http://www.digitalmars.com/d/changelog.html
>>>
>>> http://ftp.digitalmars.com/dmd.1.011.zip
>>
>>
>> ----
>> struct HttpStatus
>> {
>>         int     code;
>>         char[]  name;
>> }
>>
>> struct HttpResponses
>> {
>>         final HttpStatus Continue = {100, "Continue"};
>> }
>>
>> void foo (inout HttpStatus status)
>> {
>> }
>>
>> void main ()
>> {
>>         foo (HttpResponses.Continue);
>> }
>> ---
>>
>> "Error: cannot modify final variable 'Continue'"
>>
>> The above used to compile. How is one supposed to declare and populate 
>> a struct that cannot subsequently be changed, and can also be passed 
>> by reference?
> 
> In the future, inout would be replaced with "const ref".

Hm... so what should be done to get this working until the new 'const' 
semantics are in place?


Sean



More information about the Digitalmars-d-announce mailing list