www.digitalmars.com         C & C++   DMDScript  

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

reply d-bugmail puremagic.com writes:
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 digitalmars.com
        ReportedBy: business3 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
}


-- 
May 12 2008
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2099


bugzilla digitalmars.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




------- Comment #1 from bugzilla digitalmars.com  2008-06-22 18:55 -------
Fixed dmd 2.015


-- 
Jun 22 2008