[clang] [clang][Sema] Warn on self move for inlined static cast (PR #76646)

Shafik Yaghmour via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 29 10:25:34 PST 2024


================
@@ -35,11 +41,14 @@ class field_test {
   int x;
   field_test(field_test&& other) {
     x = std::move(x);  // expected-warning{{explicitly moving}}
+    x = static_cast<int&&>(x);  // expected-warning{{explicitly moving}}
----------------
shafik wrote:

Can you add some tests where we should not get diagnostics for example like the one right below but w/ `static_cast`

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


More information about the cfe-commits mailing list