digitalmars.D.bugs - dmd 101: crash
- Regan Heath (18/18) Sep 12 2004 class A {
- Tyro (5/25) Sep 12 2004 Isn't this intended behavior? A const must be defined not declared (ie.,...
- Regan Heath (7/31) Sep 12 2004 Yes, the error is correct, line 5 is "b = 2;" in the ctor for the class....
- Tyro (2/8) Sep 12 2004 I C. Thanks for clarifying!
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> ReganIsn't this intended behavior? A const must be defined not declared (ie., 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: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/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> ReganIsn't this intended behavior? A const must be defined not declared (ie., It's value must be know upon first encounter). And once known, such value cannot be overridden.
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. ReganI C. Thanks for clarifying! Andrew
Sep 12 2004