[clang] [Sema] Fix parameter index checks on explicit object member functions (PR #165586)

via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 29 21:59:18 PDT 2025


================
@@ -11,6 +11,11 @@ struct S {
 
   void h(const char*) __attribute__((nonnull(1))); // \
       expected-error{{invalid for the implicit this argument}}
+
+  void i(this S* self, const char*) __attribute__((nonnull(1)));
+
+  void j(this S* self, const char*) __attribute__((nonnull(3))); // \
+      expected-error{{'nonnull' attribute parameter 1 is out of bounds}}
----------------
Sirraide wrote:

Also add a test to make sure that parameter index `2` works.

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


More information about the cfe-commits mailing list