DMD 1.011 release -- prior code does not compile

kris foo at bar.com
Wed Apr 11 12:39:19 PDT 2007


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?

(if you change 'final' to 'const' within the HttpResponses struct, the 
same error is generated, and saying "final" rather than "const")




More information about the Digitalmars-d-announce mailing list