[clang] [clang] Fix-it hint for `++this` -> `++*this` when deref is modifiable (PR #94159)

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 17 12:33:42 PDT 2024


================
@@ -0,0 +1,49 @@
+// RUN: %clang_cc1 -std=c++23 -fsyntax-only -verify %s
+
+struct S {
+  void f() {
+    ++this; // expected-error {{expression is not assignable}}
+    // expected-note at -1 {{add '*' to dereference it}}
+  }
+
+  void g() const {
+    ++this; // expected-error {{expression is not assignable}}
----------------
zygoloid wrote:

Likewise.

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


More information about the cfe-commits mailing list