<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 - Enum class variables can't be used as function arguments"
   href="https://bugs.llvm.org/show_bug.cgi?id=39459">39459</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Enum class variables can't be used as function arguments
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>lldb
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </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>All Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>lldb-dev@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>clayborg@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Compile the following code
enum class Foo : short {
  a,b,c
};

bool UseFoo(Foo f) {
  return (bool)f;
}

int main() {
  Foo foo = Foo::a;
  auto r = UseFoo(foo); // breakpoint
}

Then debug it and try to call "UseFoo" with an enumeration:

$ lldb a.out 
(lldb) target create "a.out"
(lldb) b /breakpoint/
(lldb) r
Process 98692 launched: '/tmp/a.out' (x86_64)
Process 98692 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
    frame #0: 0x0000000100000f9e a.out`main at /tmp/main.cpp:11
   8    
   9    int main() {
   10     Foo foo = Foo::a;
-> 11     auto r = UseFoo(foo); // breakpoint
   12   }
   13   
Target 0: (a.out) stopped.
(lldb) p UseFoo(Foo::b)
error: no matching function for call to 'UseFoo'
candidate function not viable: no known conversion from 'short' to 'Foo' for
1st argument
(lldb) p UseFoo((Foo)Foo::b)
(bool) $0 = true</pre>
        </div>
      </p>


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

      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>