<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/54433>54433</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
clang considers friend decl in qualified name lookup for class def?
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang:frontend,
accepts-invalid
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
Superty
</td>
</tr>
</table>
<pre>
```cpp
namespace name {
class A {
friend class B;
};
}
class name::B { };
```
clang seems to accept this, whereas gcc complains:
```
test.cpp:7:15: error: qualified name does not name a class before ‘{’ token
7 | class name::B { };
|
```
I'm no language lawyer, but my reading of cppreference seems to indicate that gcc is correct here.
> A name first declared in a friend declaration within a class or class template X becomes a member of the innermost enclosing namespace of X, but is not visible for lookup (except argument-dependent lookup that considers X) unless a matching declaration at the namespace scope is provided
https://en.cppreference.com/w/cpp/language/friend
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyFk02ToyAQhn8NXromZSQm8eAhmZlU7Xkvc0VoDTsILmCy-ffbaL5ma6rWQm0Bm_d9GhqnLjVb53OTw8DyN5bvrOgxDEIipAjYZj_3SyNCgN2jA6D1Gq2CeWTP-HWAbd6-xE-_p5SM76jtUyL4MvUm5f6D7SAg9gGiAyElDhHiUQdWvML5iB5FgE5KkK4fjNA2UFr4NlfEEBfJId9t6F6WaSZ673wKfo_C6Fajmh0rhyTUxflLXO012DpPON4Lts1ZtU0YrnFF-j7R3qgAbMjXK_zfMUxXmvu4vtU_P3-wYtOTMkhkRtEhBecL-sSjGSP0FyAmShM21wLZ9dgSJUulvGPUVmkpIhJIESd6OhBA71FGSEwXzysy_k4Vnzi02ocICsmVJ1LaEplr_edOEbWzcNZUIXun5vw1iJhqROt-EEkqGCEW0GPfoE9i4xEppUXfO1qFJBsXko_HZqRJHzejeq7PSQfdGJJGqxjnPscBWLHFP9NGEb4be7TxReFAIim6zZmcS2eDVuhDylrBaA2GSZKI8phWfjYl4iTwISZIN2CSMXh3ojRqxnWMcUibkBUHamgXzzVYkGvqPdOddmJxuFWRwhlkpmquKl6JLOposJ5PwEPpE-7E_59te3XX3pErbBk_ZKM39VdhHdVobK56jDndXi_k5hftA_rUIYxIB-1QrlacZ8e6XPMqly02XFZNtZQlLze45kuOspTL9SYzokETalbuWVFMymm91jsbSTN1pdrRaz7G4UXbE6mfBsq3TNdFXhQ5X27zbVkutwu1FGu14mqVl4hb0bJVjr3QZpF0LpzvMl9PkpuxCzRodIjhMUj2dWcRJzmUX4zx6Hz9cxzQx0s2uasna38BemyXfQ">