https://issues.dlang.org/show_bug.cgi?id=15478
Issue ID: 15478
Summary: Constant folding inconsistency
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: [email protected]
Reporter: [email protected]
struct Foo(N)
{
this(N value) { }
auto bug() { return 0; }
}
void main()
{
enum Foo!int foo = 0;
Foo!int[foo.bug] bar; // Error: integer constant expression expected
instead of Foo().bug
enum foo_bug = foo.bug;
Foo!int[foo_bug] baz; // OK
}
The declarations of `baz` and `bar` should be semantically equivalent, but
apparently something went wrong with `bar`.
(This was reduced from a much larger program which triggered the problem
seemingly at random. very annoying.)
--