[Issue 10121] New: Declarations before first case level in switch statement are allowed
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun May 19 12:32:42 PDT 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10121
Summary: Declarations before first case level in switch
statement are allowed
Product: D
Version: unspecified
Platform: All
OS/Version: All
Status: NEW
Keywords: accepts-invalid, wrong-code
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: maxim at maxim-fomin.ru
--- Comment #0 from Maxim Fomin <maxim at maxim-fomin.ru> 2013-05-19 12:32:41 PDT ---
extern(C) int printf(const char*, ...);
void main()
{
switch(0)
{
int a = 4; // if immutable, prints 4
case 0:
printf("%d\n", a); //prints 0
}
}
After the switch there is jump to zero case without proper initialization of
'a'.
--
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