The c++ cast examples use un-quoted < and >'s, For example, the cast away const row shows up as const_castp
Comment #1 by braddr — 2007-06-18T02:12:01Z
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.
Comment #3 by matti.niemenmaa+dbugzilla — 2007-06-18T03:37:47Z
Under "Final Storage Class", a struct has a constructor, which is invalid code.
Comment #4 by braddr — 2007-06-18T03:42:33Z
(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. :)
Comment #5 by onlystupidspamhere — 2007-06-18T05:50:46Z
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
Comment #6 by matti.niemenmaa+dbugzilla — 2007-06-18T07:42:12Z
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;
Comment #7 by kamm-removethis — 2007-06-19T07:36:44Z
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