Bug 10456 – struct containing enum X, alias X this and a dynamic array no longer compiles since 2.063
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-06-23T17:09:00Z
Last change time
2013-06-28T06:09:44Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
gassa
Comments
Comment #0 by gassa — 2013-06-23T17:09:20Z
I have reduced my problematic code to this:
-----
struct TheStruct
{
enum TheEnum {ELEMENT};
alias TheEnum this;
int [] x;
}
-----
It produces the following errors:
-----
Error: type TheEnum is not an expression
Error: type TheEnum is not an expression
-----
Notes:
1. Compiles fine with DMD 2.062. Gives the errors with 2.063 and 2.063.2.
2. It does print the error twice.
3. No file or line number in the message complicates debugging.
4. "int [] x" cannot be further reduced to "int x". Seems it has to be a dynamic array (of anything), associative array, a class or struct containing such an array, or something similar to produce the error. If TheStruct is a class instead of a struct, the error also vanishes in my case.
Ivan Kazmenko.