summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/attr-format.cpp
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2010-11-16 08:49:43 +0000
committerChandler Carruth <chandlerc@gmail.com>2010-11-16 08:49:43 +0000
commit1c8383dccd4729f6e35982a82601f1985267e127 (patch)
tree958df6414688618bbf80555dca0ead09b8373673 /clang/test/SemaCXX/attr-format.cpp
parent743682bb9f6646f5574a6b0e152db62ba33f9e9c (diff)
downloadbcm5719-llvm-1c8383dccd4729f6e35982a82601f1985267e127.tar.gz
bcm5719-llvm-1c8383dccd4729f6e35982a82601f1985267e127.zip
Fix PR8625 and correctly interpret member-calls to static members when
producing warnings. This feels really fragile, and I've not audited all other argument index-based warnings. I suspect we'll grow this bug on another warning eventually. It might be nice to adjust the argument indices when building up the attribute AST node, as we already have to remember about the 'this' argument within that code to produce correct errors. llvm-svn: 119340
Diffstat (limited to 'clang/test/SemaCXX/attr-format.cpp')
-rw-r--r--clang/test/SemaCXX/attr-format.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/clang/test/SemaCXX/attr-format.cpp b/clang/test/SemaCXX/attr-format.cpp
index bf131496007..da134a136d2 100644
--- a/clang/test/SemaCXX/attr-format.cpp
+++ b/clang/test/SemaCXX/attr-format.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -Wformat-nonliteral -verify %s
struct S {
static void f(const char*, ...) __attribute__((format(printf, 1, 2)));
static const char* f2(const char*) __attribute__((format_arg(1)));
@@ -21,3 +21,15 @@ struct A { void a(const char*,...) __attribute((format(printf,2,3))); };
void b(A x) {
x.a("%d", 3);
}
+
+// PR8625: correctly interpret static member calls as not having an implicit
+// 'this' argument.
+namespace PR8625 {
+ struct S {
+ static void f(const char*, const char*, ...)
+ __attribute__((format(printf, 2, 3)));
+ };
+ void test(S s, const char* str) {
+ s.f(str, "%s", str);
+ }
+}
OpenPOWER on IntegriCloud