diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2015-05-27 18:47:56 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2015-05-27 18:47:56 +0000 |
commit | 5e20cdd81c44a443562a09007668ffdf76c455af (patch) | |
tree | dbbd4047878da71c1a706e26ce05b4e7791b14cc /test/SemaCXX/format-strings.cpp | |
parent | d5f23b0b7528b5c3caed1ba14f897cc4aaa9e3c3 (diff) |
Notes
Diffstat (limited to 'test/SemaCXX/format-strings.cpp')
-rw-r--r-- | test/SemaCXX/format-strings.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/SemaCXX/format-strings.cpp b/test/SemaCXX/format-strings.cpp index 41775708feb71..fa7251d0dd764 100644 --- a/test/SemaCXX/format-strings.cpp +++ b/test/SemaCXX/format-strings.cpp @@ -133,3 +133,18 @@ namespace Templates { } } +namespace implicit_this_tests { +struct t { + void func1(const char *, ...) __attribute__((__format__(printf, 1, 2))); // expected-error {{format attribute cannot specify the implicit this argument as the format string}} + void (*func2)(const char *, ...) __attribute__((__format__(printf, 1, 2))); + static void (*func3)(const char *, ...) __attribute__((__format__(printf, 1, 2))); + static void func4(const char *, ...) __attribute__((__format__(printf, 1, 2))); +}; + +void f() { + t t1; + t1.func2("Hello %s"); // expected-warning {{more '%' conversions than data arguments}} + t::func3("Hello %s"); // expected-warning {{more '%' conversions than data arguments}} + t::func4("Hello %s"); // expected-warning {{more '%' conversions than data arguments}} +} +} |