<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Invalid results for -Wreturn-type, -Wcovered-switch-default dealing with enum class switch statements"
   href="https://bugs.llvm.org/show_bug.cgi?id=33699">33699</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Invalid results for -Wreturn-type, -Wcovered-switch-default dealing with enum class switch statements
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>-New Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>tamir.bahar@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Overview:

When using an enum-class in a switch-statement, both -Wreturn-type and
-Wcovered-switch-default give erroneous results.

Steps To Reproduce:

Compile the following code with both the warnings enabled (-Wreturn-type
-Wcovered-switch-default

enum class A{x, y};

int f(A a) {
    switch (a) {
        case A::x: return 0;
        case A::y: return 1;
    }
}

int g(A a) {
    switch (a) {
        case A::x: return 0;
        case A::y: return 1;
        default: return 2;
    }
}

Actual Results:

The following warning is displayed

warning: default label in switch which covers all enumeration values
[-Wcovered-switch-default]
       default: return 2;


Expected Results:

There should be no warning for the default case in function g, and there should
be a return-type warning for function f.

Clang Version:

clang version 5.0.0 (trunk 307237)
Target: x86_64-unknown-linux-gnu
Thread model: posix</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>