This code should be compiled:
------------------
A a;
const struct A { }
A b;
static assert(is(typeof(a) == typeof(b))); // Error: static assert (is(A == const(A))) is false
Comment #1 by k.hara.pg — 2011-12-28T23:54:51Z
From http://d-programming-language.org/struct.html
> Const and Invariant Structs
>
> A struct declaration can have a storage class of const, immutable or shared.
> It has an equivalent effect as declaring each member of the struct as const,
> immutable or shared.
Then the definition of const struct A {} should translated to:
struct A { const: (members...) }
But, instead, current dmd implementation does like follows:
struct __S { int a; int b = 2; }
alias const(__S) S;
--------
But, the documentation also has some inconsistent.
See bug 7180.