[clang] [clang] Add diagnostic for friend declaration of closure type member (PR #191419)

via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 14 06:59:54 PDT 2026


StefanPaulet wrote:

> Thanks for working on this
> 
> --
> 
> Can you add a test to test/CXX/drs/cwg17xx.cpp? (and re run `www/make_cxx_dr_status`?
> 
> This change needs a release note. Please add an entry to `clang/docs/ReleaseNotes.rst` in the section the most adapted to the change, and referencing any Github issue this change fixes. Thanks!
> 
> --

Did the changes. 

On a side-note, are there any practical benefits to rejecting friend declarations in lambdas? I can't find the motivation for it; gcc seems to use this to not do access control checking in a lambda: https://godbolt.org/z/TsP6PaqhW. But it also does not do it when the closure type is friended, which should be allowed.

https://github.com/llvm/llvm-project/pull/191419


More information about the cfe-commits mailing list