1// RUN: %clang_cc1 -fsyntax-only -fblocks -Wformat -verify %s -Wno-error=non-pod-varargs
2
3int (^block) (int, const char *,...) __attribute__((__format__(__printf__,2,3))) = ^ __attribute__((__format__(__printf__,2,3))) (int arg, const char *format,...) {return 5;};
4
5class HasNoCStr {
6  const char *str;
7 public:
8  HasNoCStr(const char *s): str(s) { }
9  const char *not_c_str() {return str;}
10};
11
12void test_block() {
13  const char str[] = "test";
14  HasNoCStr hncs(str);
15  int n = 4;
16  block(n, "%s %d", str, n); // no-warning
17  block(n, "%s %s", hncs, n); // expected-warning{{cannot pass non-POD object of type 'HasNoCStr' to variadic block; expected type from format string was 'char *'}} expected-warning{{format specifies type 'char *' but the argument has type 'int'}}
18}
19