www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15538] New: final switch statement raises an exception even

https://issues.dlang.org/show_bug.cgi?id=15538

          Issue ID: 15538
           Summary: final switch statement raises an exception even though
                    all cases are covered und certain conditions
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: johannes.loher fg4f.de

Created attachment 1573
  --> https://issues.dlang.org/attachment.cgi?id=1573&action=edit
code example

When compiling the attached code with DMD and the running it,
core.exception.SwitchError is raised, even though all cases are covered. The
conditions for this to happen seem quite random to me: Small changes in the
setup that should not have any effect on the outcome actually change whether an
exception is raised or not. Compiling with -g prevents an exception from being
raised (i.e. it works as it should). More examples are covered in my code
example.

Binaries created by gdc and ldc behave as expected and do not raise an
exception.

--
Jan 09