www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21404] New: Case where dmd emits twice a warning about

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

          Issue ID: 21404
           Summary: Case where dmd emits twice a warning about
                    non-reachable statement
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: diagnostic
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: b2.temp gmx.com

For the following code, compield with -w

---
module double_warn;

enum E {e}

void main()
{
    E e;
    final switch (e)
        case E.e:
        {
            assert(false);
            break;
        }   
}    
---

The compiler warns:

 double_warn.d(12): Warning: statement is not reachable
 double_warn.d(12): Warning: statement is not reachable
There should be only one. --
Nov 18 2020