[Issue 2099] New: Text and Sample Code Disagree (non-static local invariant declaration)

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon May 12 02:45:01 PDT 2008


http://d.puremagic.com/issues/show_bug.cgi?id=2099

           Summary: Text and Sample Code Disagree (non-static local
                    invariant declaration)
           Product: D
           Version: unspecified
          Platform: All
               URL: http://www.digitalmars.com/d/2.0/const3.html
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: www.digitalmars.com
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: business3 at twistedpairgaming.com


On the page (http://www.digitalmars.com/d/2.0/const3.html), in the section
"Invariant Storage Class", the text and sample code disagree on when non-static
local invariant declarations are evaluated (compile-time or run-time).

The text says (asterisk emphasis added):

"The initializer for a non-static local invariant declaration is evaluated at
***compile time***:"

But the sample code immediately following says (asterisk emphasis added):

int foo(int f)
{
  invariant x = f + 1;  // evaluated at ***run time***
  x = 3;                // error, x is invariant
}


-- 



More information about the Digitalmars-d-bugs mailing list