[clang] [Sema] Fix parameter index checks on explicit object member functions (PR #165586)
Vladimir Vuksanovic via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 31 01:26:22 PDT 2025
================
@@ -11,13 +11,16 @@ struct S {
// the format argument is argument 2 here.
void g(const char*, ...) __attribute__((format(printf, 2, 3)));
const char* g2(const char*) __attribute__((format_arg(2)));
+ void g3(this S&, const char *, ...) __attribute__((format(printf, 2, 3)));
void h(const char*, ...) __attribute__((format(printf, 1, 4))); // \
expected-error{{implicit this argument as the format string}}
void h2(const char*, ...) __attribute__((format(printf, 2, 1))); // \
expected-error{{out of bounds}}
const char* h3(const char*) __attribute__((format_arg(1))); // \
expected-error{{invalid for the implicit this argument}}
+ void h4(this S&, const char *, ...) __attribute__((format(printf, 1, 3))); // \
+ expected-error {{format argument not a string type}}
----------------
vvuksanovic wrote:
Added the testcase.
https://github.com/llvm/llvm-project/pull/165586
More information about the cfe-commits
mailing list