3264 – -O causes wrong "used before set" error when using enum.

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 3264 - -O causes wrong "used before set" error when using enum.
Summary: -O causes wrong "used before set" error when using enum.
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: Other Windows
: P2 normal
Assignee: No Owner
URL:
Keywords: rejects-valid
Depends on:
Blocks:
Reported: 2009年08月25日 05:01 UTC by Don
Modified: 2015年06月09日 01:28 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 2009年08月25日 05:01:40 UTC
OK when compiled normally, but when compiled with -O, generates:
interpret.d(2367): Error: variable Q used before set
--------
void bug()
{
 enum int Q=0;
 string [2] s = ["a", "b"]; 
 assert(s[Q].dup=="a");
}
Comment 1 Walter Bright 2009年08月26日 16:25:35 UTC
This bug does affect D1, but in different ways.
Comment 2 Walter Bright 2009年09月03日 13:28:17 UTC
Fixed dmd 1.047 and 2.032


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