<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/73844>73844</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            enumerators of `enum` definition with *nested-name-specifier* are injected into the wrong scope
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          zygoloid
      </td>
    </tr>
</table>

<pre>
    Clang accepts this:

```c++
namespace N {
    enum E : int;
}

enum N::E : int { A };

auto a = A;
auto b = N::A;
```

... even though it seems clear that the name `A` should only be introduced in namespace `N` and not in the global namespace.

The language rules also seem to get this wrong, saying that `A` should be introduced *only* in the global namespace and not in `N`:

> [dcl.enum]/12: The name of each unscoped enumerator is also bound in the scope that immediately contains the *enum-specifier*.

... but that seems to be a bug in the language rules.

GCC, MSVC, and EDG all do the "obvious" thing and introduce the name `A` in namespace `N` only.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx0VM2OozwQfBpzaQUZEyAcODDJZE7fXL7R3g3ugFfGjrA9o-zTr2zI3-yuhEDqborqqjLcWjloxIYUL6Q4JNy70czNr8tglJEi6Yy4NHvF9QC87_HsLLhRWpK3hB4Ivd5Lulw9YS_hilXNJ7Rn3iO8A6nWIgAAaj_BK5C8BakdydcWqQ6PoHHqPXwpb2_DAQhaCKO31-Kde2eAA8kP0N5asdjF4gp07904P6KkaQr4iRrcaPwwgnRgEScLvUI-gxu5AzcihNWAlBEF7Gi8EmC0ukCHgeVshO9RgNRwF4GU9D2Mcy1AGxeaAWpQpuPqPpc-8vkYEYL4ng8Is1dogStrIilwBgZ00Q_4mo0eCNuD5Reph4XpN4LP3AhrA2PC2n8xeWS6kv_ue_4KpHgRvUqDW6Q4EHbMWPDq46qSOQHyfgSvbW_OKKL7OHNnZpDrOp3xWlxpxLFlATlNKCR3qC7QG-241DbOEBbjsbFn7OVJ4kxYm343svNugVksDFFA4ND54fqpZ2mfAN72-yDnf___iM8gxevhDbhSIMzKgZnuUxpvCWPBhXBG4hqrxn8m5a95CC6kiWhyUec1T7DJKpqxXVXVVTI2WZWzqmBY1FtWsopnBe0E1qe-7mi1o3UiG0ZZnmWszuqizKuUZkhPZZntsGMso0i2FCcuVarU55SaeUiktR6bKt9tt4niHSobjz9jGr8gNglj4W8wN-GdTecHS7ZUSevsHcVJp7C5u2mD1aSkMQklBYEnqaWTRsOXdGPwTKN1KDZBgyfrgM8hmz-xd_HUuEXhGOolD4mfVTM6d46_HnYk7DhIN_ou7c1E2DGwWh-b82wCEmHHuIsl7Bh3_R0AAP__XFyGWg">