www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 1273] New: final-const-invariant.html html errors

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1273

           Summary: final-const-invariant.html html errors
           Product: D
           Version: 2.000
          Platform: PC
               URL: http://www.digitalmars.com/d/final-const-invariant.html
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: www.digitalmars.com
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: braddr puremagic.com


The c++ cast examples use un-quoted < and >'s,  For example, the cast away
const row shows up as const_castp


-- 
Jun 17 2007
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1273





------- Comment #1 from braddr puremagic.com  2007-06-18 02:12 -------
Maybe this should be in a separate bug report, but since you can fix 'em both
with  little effort, the declarations page,
http://www.digitalmars.com/d/declaration.html, ought to have the const, final,
and invariant StorageClass entries linked up to this explanation page.  There's
nothing anywhere on the page (other than the left nav pane) to help explain
'em.


-- 
Jun 18 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1273





------- Comment #2 from braddr puremagic.com  2007-06-18 02:22 -------
http://www.digitalmars.com/d/changelog.html
The 2.000 block ought to have the line referring to the new feature linked to
the description page.


-- 
Jun 18 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1273


deewiant gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |deewiant gmail.com
           Keywords|                            |spec
         OS/Version|Windows                     |All
           Platform|PC                          |All




------- Comment #3 from deewiant gmail.com  2007-06-18 03:37 -------
Under "Final Storage Class", a struct has a constructor, which is invalid code.


-- 
Jun 18 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1273





------- Comment #4 from braddr puremagic.com  2007-06-18 03:42 -------
(In reply to comment #3)
 Under "Final Storage Class", a struct has a constructor, which is invalid code.

Let's just call that a sneak preview. :) --
Jun 18 2007
prev sibling next sibling parent Extrawurst <spam extrawurst.org> writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1273

the doc quotes following code to be valid:

int foo(int f) { return f * 3; }
invariant int z = foo(2) + 1;

<- Error: cannot evaluate foo(2) at compile time
but the compiler does not
Jun 18 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1273





------- Comment #6 from deewiant gmail.com  2007-06-18 07:42 -------
It works at global scope, or if foo() is made static:

void main() {
        static int foo(int f) { return f * 3; }
        invariant int z = foo(2) + 1;
}

int foo(int f) { return f * 3; }
invariant int z = foo(2) + 1;


-- 
Jun 18 2007
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1273





------- Comment #7 from kamm incasoftware.de  2007-06-19 07:36 -------
The final const invariant page gives this example:

invariant(int) y;
y = 3;        // ok
auto q = &y;  // q's type is invariant(int)*
*q = 4;       // error, invariant

But the line marked as an error compiles fine. Additionally:

static if(is(typeof(y) == int)) // this passes
  pragma(msg, "y is of type int"); 
static if(is(invariant(int) == int)) // but this doesn't
  pragma(msg, "invariant(int) is same as int");
static if(is(typeof(q) == int*)) // this passes again
  pragma(msg, "&y is of type int*");

Something else, but related
static if(is(invariant int == invariant(int))) // passes too, though they're
different


-- 
Jun 19 2007