[PATCH] D124613: In MSVC compatibility mode, friend function declarations behave as function declarations

Reid Kleckner via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon May 16 09:25:43 PDT 2022


rnk added a comment.

I haven't given any input yet because I haven't yet seen a reduced example of the conforming code that is broken by this change. If someone can put together a small godbolt example that shows the issue affecting ADL, I'd appreciate it.

I don't fully understand the code patterns, but I think what I find most compelling so far is that we want clang users to **be able** to write conforming code, while accepting as much code that MSVC accepts with possible, ideally with warnings guiding folks to make code conform. Every goal can be compromised, there are no absolutes, so in the end, it's all tradeoffs.

Initially this patch appealed to me because it was a small change to accept what seemed like a small edge case of friend function definitions. It didn't seem worth coding up new codepaths for diagnostics. However, on reflection, the friend function definition is one of the gnarliest corners of the C++ language because of the mismatch between the lexical and semantic scopes. More care is probably required.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D124613/new/

https://reviews.llvm.org/D124613



More information about the cfe-commits mailing list