[clang] [Sema] -Wpointer-bool-conversion: suppress lambda function pointer conversion diagnostic during instantiation (PR #83497)

Fangrui Song via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 1 08:51:50 PST 2024


================
@@ -92,6 +92,19 @@ void foo() {
   bool is_true = [](){ return true; };
   // expected-warning at -1{{address of lambda function pointer conversion operator will always evaluate to 'true'}}
 }
+
+template <typename... Ts>
+static bool IsFalse(const Ts&...) { return false; }
+template <typename T>
+static bool IsFalse(const T& p) {
+  bool b;
+  b = f7; // expected-warning {{address of lambda function pointer conversion operator will always evaluate to 'true'}}
+  return p ? false : true;
----------------
MaskRay wrote:

Thanks for the suggestion! Adjusted to 80-col.

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


More information about the cfe-commits mailing list