digitalmars.D.bugs - dmd 101: crash
- Regan Heath <regan netwin.co.nz> Sep 12 2004
- Tyro <ridimz_at yahoo.dot.com> Sep 12 2004
- Regan Heath <regan netwin.co.nz> Sep 12 2004
- Tyro <ridimz_at yahoo.dot.com> Sep 12 2004
class A {
const int b;
this()
{
b = 2;
}
}
void main()
{
A a = new A();
a.b = 5; //remove this line, no crash
}
D:\D\src\temp>dmd const.d
const.d(5): b is not an lvalue
<crash>
Regan
--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
Sep 12 2004
Regan Heath wrote:class A { const int b; this() { b = 2; } } void main() { A a = new A(); a.b = 5; //remove this line, no crash } D:\D\src\temp>dmd const.d const.d(5): b is not an lvalue <crash> Regan
It's value must be know upon first encounter). And once known, such value cannot be overridden. Andrew
Sep 12 2004
On Sun, 12 Sep 2004 21:37:56 -0400, Tyro <ridimz_at yahoo.dot.com> wrote:Regan Heath wrote:class A { const int b; this() { b = 2; } } void main() { A a = new A(); a.b = 5; //remove this line, no crash } D:\D\src\temp>dmd const.d const.d(5): b is not an lvalue <crash> Regan
It's value must be know upon first encounter). And once known, such value cannot be overridden.
Yes, the error is correct, line 5 is "b = 2;" in the ctor for the class. However, the compiler crashes when it sees the "a.b = 5;" line, that is the bug. Regan -- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
Sep 12 2004
Yes, the error is correct, line 5 is "b = 2;" in the ctor for the class. However, the compiler crashes when it sees the "a.b = 5;" line, that is the bug. Regan
I C. Thanks for clarifying! Andrew
Sep 12 2004








Tyro <ridimz_at yahoo.dot.com>