[Issue 15478] New: Constant folding inconsistency
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sat Dec 26 13:17:50 PST 2015
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: nobody at puremagic.com
Reporter: thomas.bockman at gmail.com
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.)
--
More information about the Digitalmars-d-bugs
mailing list