[Issue 1399] New: Wrapping a case statement in a version statement gives a shadowing declaration error.

BCS ao at pathlink.com
Sun Aug 5 14:50:39 PDT 2007


Reply to d-bugmail at puremagic.com,

> http://d.puremagic.com/issues/show_bug.cgi?id=1399
> 
> Summary: Wrapping a case statement in a version statement
> gives a
> shadowing declaration error.
> Product: D
> Version: 1.019
> Platform: PC
> OS/Version: Linux
> Status: NEW
> Keywords: rejects-valid
> Severity: normal
> Priority: P2
> Component: DMD
> AssignedTo: bugzilla at digitalmars.com
> ReportedBy: aziz.kerim at gmail.com
> When compiling the snippet below with -version=D2 I get the following
> error: "Error: shadowing declaration func.a is deprecated"
> 
> void func()
> {
> switch(1)
> {
> case 1:
> auto a = 2;
> break;
> version(D2)
> {
> case 2:
> auto a = 2; // error
> break;
> }
> default:
> }
> }

Invalid: version blocks are not a naming scope.

Well it might be a bug because it should be a "can't have two a's" error, 
not a shadowing error




More information about the Digitalmars-d-bugs mailing list