<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 - elaborated-enum-base incompatible with NS_ENUM"
   href="https://bugs.llvm.org/show_bug.cgi?id=49413">49413</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>elaborated-enum-base incompatible with NS_ENUM
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>11.0
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>MacOS X
          </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>C++
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>lhunath@lyndir.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>blitzrakete@gmail.com, dgregor@apple.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Related to
<a href="https://github.com/llvm/llvm-project/commit/c90e198107431f64b73686bdce31c293e3380ac7">https://github.com/llvm/llvm-project/commit/c90e198107431f64b73686bdce31c293e3380ac7</a>

The new `-Welaborated-enum-base` appears to be incompatible with macros to
define nonfixed type enums.

One such example is Apple's NS_ENUM, which effectively translates:

```
typedef NS_ENUM( X, unsigned int) {
...
}
```

into:

```
typedef enum X : unsigned int X;
enum X : unsigned int {
```

Which triggers:

```
fatal error: non-defining declaration of enumeration with a fixed underlying
type is only permitted as a standalone declaration; missing list of
enumerators? [-Welaborated-enum-base]
```

The idea behind macros such as `NS_ENUM` is that they type the enum if
supported by the compiler, as well as hide the `enum` type keyword.

Unfortunately, the only way to do this now would be to remove the nonfixed type
from the typedef, but this causes another problem:

```
error: enumeration previously declared with nonfixed underlying type
```

This can only be addressed by moving the typedef below the enum declaration,
but unfortunately it appears that this is impossible to achieve with a macro.

Consequently, `clang` can no longer compile `NS_ENUM`-style macros, and there
is no path for resolving the issue other than by disabling
`elaborated-enum-base`.</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>