Comment #0 by bearophile_hugs — 2011-01-25T02:59:10Z
This crashes DMD 2.051:
align(0) struct Foo {
char c;
int i;
}
void main() {
Foo f = Foo();
}
---------------
This causes an Access Violation with DMD 2.051:
align(0) struct Foo {
int i, j;
}
void main() {
Foo f = Foo();
}
Comment #1 by clugdbug — 2011-02-10T12:54:55Z
Cannot reproduce.
The second case gives a runtime access violation, but neither example causes a compiler segfault.
Is align(0) really valid? I don't think it makes sense. It's definitely illegal on Microsoft VC++, I don't see it documented on DMC++ or GCC, but in both cases it appears unlikely.
Comment #2 by bearophile_hugs — 2011-02-10T13:54:34Z
(In reply to comment #1)
> Cannot reproduce.
You are right, to crash is the compiled program (with DMD 2.051 on Windows).
> The second case gives a runtime access violation, but neither example causes a
> compiler segfault.
As in the first case this time the compiled program gives:
object.Error: Access Violation
> Is align(0) really valid? I don't think it makes sense.
I agree, I suggest to turn it into a compile-time error (as negative numbers already do).