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

Vlad Serebrennikov via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 17 08:12:16 PDT 2026


================
@@ -222,3 +222,19 @@ template <template <typename> class Template, typename Argument>
 using Bind = Instantiate<Internal<Template>::template Bind, Argument>;
 #endif
 } // namespace cwg1794
+
+namespace cwg1780 { // cwg1780: 22
+#if __cplusplus >= 201103L
+
+auto l = []() -> int { return 5; };
+using L = decltype(l);
+class A {
+#if __cplusplus >= 201703L
----------------
Endilll wrote:

I see, thank you for checking.
I think something like this would be better:
```cpp
#if __cplusplus >= 201703L
#define CONSTEXPR constexpr
#elif __cplusplus >= 201103L
#define CONSTEXPR
#endif
```
Then you can unify the declarations by placing `CONSTEXPR` in the right spot.

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


More information about the cfe-commits mailing list