| Issue |
115350
|
| Summary |
Name lookup of friend names is wrong on clang-cl
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
csimon-bambecksystems
|
Names introduced as friends do not participate in name lookup [as explained here on cpprefererence](https://en.cppreference.com/w/cpp/language/namespace#Namespaces), so the problem with the following ill-formed code:
```
class foo {
friend class bar;
using baz = bar; // Error! Name lookup does not find bar.
};
```
is the name `bar` has not been introduced for name-lookup purposes. MSVC acceps it (that's their problem) but weirdly, clang-cl accepts it and does not warn about a "microsoft extension." I can reproduce it on godbolt with either x86 msvc v19.latest or clang-cl 18.1.0 as the compiler. I know that clang-cl accepts some non-standard name lookup for class templates but this is not a class template, just a regular class. Fun story: I wrote a whole boatload of classes relying on this, uh, "idiom" that I thought I discovered, and I was feeling so good about myself. Then I confidently fed it to another compiler, just another clang with different configuration actually, and *sound of world crashing down.*
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs