May 20, 2003 constant evaluation with conditional expression | ||||
---|---|---|---|---|
| ||||
enum {A=1} enum {B=A?0:1} This simple constant assignment does not work. This snippet generate following error message. "non-constant expression 1 ? 0 : 1" It obviously is constant expression, isn't it? enum {A=1} enum {B=A+1} This works. It looks that conditioanl expression never evaluated to constant value. The same is true for "const" attribute. const int i = 1; const int j = i?0:1; This code generates the same error message. |
May 21, 2003 Re: constant evaluation with conditional expression | ||||
---|---|---|---|---|
| ||||
Posted in reply to Yung-Hei, Lee | Yes, it should work. I'll add it to the bug list. |
Copyright © 1999-2021 by the D Language Foundation