6049 – [CTFE]: Array literals of structs with invariant() are wrong

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 6049 - [CTFE]: Array literals of structs with invariant() are wrong
Summary: [CTFE]: Array literals of structs with invariant() are wrong
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: Other Windows
: P2 regression
Assignee: No Owner
URL:
Keywords: wrong-code
Depends on:
Blocks:
Reported: 2011年05月23日 21:27 UTC by Don
Modified: 2015年06月09日 05:11 UTC (History)
1 user (show)

See Also:


Attachments
Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this issue.
Description Don 2011年05月23日 21:27:29 UTC
Applies only to the latest DMD in git. Reduced from unittest failure in std.datetime.
---
struct Bug6049 {
 int m;
 this(int x) { m = x; }
 invariant() { }
}
const Bug6049[] foo6049 = [Bug6049(6), Bug6049(17)];
static assert(foo6049[0].m == 6);
---
Comment 1 Jonathan M Davis 2011年05月23日 21:35:53 UTC
So, as a temporary fix to make the autotester is passing, commenting out the invariants should fix the problem?
Comment 2 Don 2011年05月24日 00:41:06 UTC
(In reply to comment #1)
> So, as a temporary fix to make the autotester is passing, commenting out the
> invariants should fix the problem?
Yes, but I already have a DMD pull request that fixes the problem <g>.
Comment 3 Jonathan M Davis 2011年05月24日 10:11:43 UTC
Then I won't worry about it :). Invariants have been a source of trouble with std.datetime though and appear to be an area in the language implementation that still has some warts. IIRC, it caused some issues with purity initially (though we can now have pure invarians fortunately), and bug# 5058 has caused definite issues as well (hence why SysTime's invariant is commented out). Well, as annoying as such bugs are, at least we're running into them so that we can fix them. Thanks for looking into this one.


AltStyle によって変換されたページ (->オリジナル) /