[clang] [clang] Add diagnostic for usage of implicit constructor with pointer to bool convertion (PR #143990)

via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 26 11:32:52 PDT 2025


================
@@ -234,3 +234,34 @@ namespace Template {
   template void h<d>();
 }
 #endif // __cplusplus < 201703L
+
+namespace implicit_constructor_bool {
+
+struct B {
+  bool a;
+  B(bool V) : a(V) {} // expected-note {{'B' declared here}}
+};
+
+void test(const B& b);
+
+void test0(B* b) {
+  test(b); // expected-warning {{implicit conversion from 'B *' to 'const B' calls}}
----------------
Ralender wrote:

Done

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


More information about the cfe-commits mailing list