Issue 9693 - unclear scoping behaviour of declarations made in static if conditions
Summary: unclear scoping behaviour of declarations made in static if conditions
Status: NEW
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P3 normal
Assignee: No Owner
URL:
Keywords: accepts-invalid
Depends on:
Blocks:
 
Reported: 2013-03-11 17:14 UTC by timon.gehr
Modified: 2022-12-17 10:45 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description timon.gehr 2013-03-11 17:14:31 UTC
With DMD 2.062, the following code compiles and runs:

void main() {
    int[string] x;
    static if (is(typeof(x) S : T[U], T, U)) { }
    pragma(msg, S, " ", T, " ", U);
}

This is not evident from the spec. The spec should clarify whether this is supposed to compile or not. If it is not, the compiler implementation should be fixed.
Comment 1 Kenji Hara 2013-03-11 22:40:19 UTC
I think this is definitely a bug. There is no usefulness.

Long time ago I found the bug, but I couldn't fix the bug.

As far as I know, std.typecons.Rebindable implementation is relied on this buggy/bad feature.