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

Rajveer Singh Bharadwaj via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 6 07:11:33 PDT 2024


================
@@ -10,6 +10,7 @@ void h() {
   SEL* ps = &s;
 
   @selector(dealloc) = s;  // expected-error {{expression is not assignable}}
+  // expected-note at -1 {{add '*' to dereference it}}
----------------
Rajveer100 wrote:

>From my knowledge, this would assign the value of s to the SEL object pointed to by @selector(dealloc). However, in Objective-C, selectors are not pointers, they are special compile-time constructs representing method names, and they are immutable, so you cannot assign values to them. 

Therefore, this syntax is not valid for selectors in Objective-C.

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


More information about the cfe-commits mailing list