Summary: statically disallow shift amounts provably outside the
                    valid range
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD

--- Comment #0 from 2012-02-28 04:30:23 PST ---
This code is rejected:

void main(){
    int y = 1<<32;

But this goes through:

void main(){
    int x;
    int y = 1<<32+(x&1);

Since the semantic analysis step already requires the compiler to be able to
compute value ranges, it would make sense to make any shift where the range of
the shift amount does not overlap [0..,31] a compile time error.

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to