You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When compiling a 'switch' in which a 'case' contains an initialized variable (see example) Clang does so without complaining. g++ on the other hand produces an error "jump to case label crosses initialization".
Extended Description
Hi!
When compiling a 'switch' in which a 'case' contains an initialized variable (see example) Clang does so without complaining. g++ on the other hand produces an error "jump to case label crosses initialization".
I'm not really sure which is correct. According to this thread (http://www.velocityreviews.com/forums/t282021-error-jump-to-case-label.html) and the explanation for it's behavior, g++ is correct.
[code]
switch (a) {
//...
case 1:
int a = 1;
break;
case 2:
//...
}
[/code]
g++ output for attached file:
clang++ output for attached file:
(compiles without error/warning)
My system:
Linux VirtUbuntu 2.6.32-24-generic #38-Ubuntu SMP Mon Jul 5 09:22:14 UTC 2010 i686 GNU/Linux
clang version 2.8 (trunk 109579)
Target: i386-pc-linux-gnu
Thread model: posix
The text was updated successfully, but these errors were encountered: