Bug 9293 – enum struct with StructInitializer reports weird error
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-01-10T22:03:00Z
Last change time
2013-01-13T02:45:54Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
k.hara.pg
Comments
Comment #0 by k.hara.pg — 2013-01-10T22:03:36Z
Spin-off from bug 9218. This code should run without assertion, but the compilation fails with weird error message.
struct A
{
// enum A zero = A(); // This works as expected
enum A zero = {}; // Note the difference here
int opCmp(const ref A a) const
{
assert(0);
}
int opCmp(const A a) const
{
return 0;
}
}
void main()
{
A a;
auto b = a >= A.zero; // Error: A() is not an lvalue
}