<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/113844>113844</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
C++: Accessing enumerators from a scoped member enum through operator `.` triggers an error
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
TheCalligrapher
</td>
</tr>
</table>
<pre>
Here's the code sample that demonsrates the problem
```
struct S
{
enum T { A };
enum class U { B };
};
int main()
{
S s;
S::A; // OK
S::T::A; // OK
S::U::B; // OK
s.A; // OK
s.T::A; // OK
s.U::B; // Error???
}
```
All six lines that refer to enumerators from enums declared inside class `S` are perfectly valid. However, Clang issues an error
```
error: 'S::U::B' is not a member of class 'S'
17 | s.U::B; // Error???
| ~~~^
```
for last one (i.e. `s.U::B`). Why?
What makes it especially weird is that Clang has no problems with the qualified name in the `s.T::A` line, i.e. it does allow one to optionally use qualified name to access enumerators from a "classic" unscoped enum (a possibility introduced by C++11). However, for some unknown reason Clang rejects a similar attempt to access an enumerator from a _scoped_ enum.
GCC and MSVC++ have no issues with such code.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUlF2vozYQhn-NczNaZEwODhdcJNlNV6qqXuRs93JlYALuGpt6TNLcnN9eYcg5OR-tVAmZjxns1887Y0WkW4tYsocde_i8UmPonC8fO9wrY3Tr1dChX1WuuZZf0SMTkiB0CLVrEEj1g0EInQrQYO8seRVwThi8qwz2jH9mfLuMOV-u-ErBj3WA4xKUu_kBAO3YwyMwuYMtMPmZZa9DtVFE8C0m7F4lvHqOo7YBeqUtExsmindLHYHe_ABwZNmWZdsty3YAAEwcmDjA778u8SX8eJf1NuWW822-7T7IuWVSclvn_SyU3C_yUfx-gVv8i_fOs-ywXM9cPrJgHrfGAOm_wWgbzVMBPJ7QQ3AROHoVnCc4edfHDwQN1kZ5bEBb0g0ulrCcH1nO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