Bug 12665 – Cannot create enum of struct within the struct, if the struct has a constructor ("cannot create a struct until its size is determined")
Status
RESOLVED
Resolution
DUPLICATE
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2014-04-27T16:29:00Z
Last change time
2014-05-02T12:14:15Z
Keywords
rejects-valid
Assigned to
nobody
Creator
smjg
Comments
Comment #0 by smjg — 2014-04-27T16:29:35Z
DMD 2.065 Win32
----------
struct DateInterval {
int value;
this(int v) { value = v; }
enum YEAR = DateInterval(365);
}
----------
C:\Users\Stewart\Documents\Programming\D\Tests\bugs>dmd datetime.d
datetime.d(5): Error: cannot create a struct until its size is determined
----------
Same error occurs if I use either
enum {
YEAR = DateInterval(365)
}
or
enum : DateInterval {
YEAR = DateInterval(365)
}
instead. However,
enum DateInterval YEAR = DateInterval(365);
compiles without error.
This has broken Stewart's Utility Library.
Comment #1 by andrej.mitrovich — 2014-04-27T18:34:55Z
This has been like this since 2.062. I've seen another bug report like this somewhere.
Comment #2 by dlang-bugzilla — 2014-05-01T19:45:42Z
Comment #4 by dlang-bugzilla — 2014-05-01T19:49:37Z
Oh, didn't look closely at the patch and error message. So is it deliberate?
Comment #5 by andrej.mitrovich — 2014-05-01T19:53:36Z
(In reply to Vladimir Panteleev from comment #4)
> Oh, didn't look closely at the patch and error message. So is it deliberate?
Actually I recall it being a bugzilla comment, not the pull request itself. I'm not sure anymore, but I'll CC Don.
Comment #6 by andrej.mitrovich — 2014-05-01T19:57:23Z