[Issue 7630] New: declaration in switch scope not initialized + CTFE error
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Mar 2 09:47:17 PST 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7630
Summary: declaration in switch scope not initialized + CTFE
error
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: dawg at dawgfoto.de
--- Comment #0 from dawg at dawgfoto.de 2012-03-02 09:47:15 PST ---
int foo(int a)
{
switch (a)
{
int res;
case 1:
res = 1;
return res;
case 2:
return res;
default:
return 0;
}
}
void main()
{
enum v1 = foo(1); // CTFE error, v->addrOnStack not set
enum v2 = foo(2); // CTFE error, used before initialization
assert(foo(2) == 0); // runtime error, res is uninitialized
}
--------
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list