Hans Wennborg | 5294c79 | 2011-12-28 13:10:50 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify -pedantic -std=c++11 %s |
| 2 | |
| 3 | extern "C" { |
| 4 | extern int scanf(const char *restrict, ...); |
| 5 | extern int printf(const char *restrict, ...); |
| 6 | } |
| 7 | |
| 8 | void f(char **sp, float *fp) { |
Ted Kremenek | ce506ae | 2012-01-20 21:52:58 +0000 | [diff] [blame] | 9 | scanf("%as", sp); // expected-warning{{format specifies type 'float *' but the argument has type 'char **'}} |
Hans Wennborg | 5294c79 | 2011-12-28 13:10:50 +0000 | [diff] [blame] | 10 | |
| 11 | printf("%a", 1.0); |
| 12 | scanf("%afoobar", fp); |
David Blaikie | a73cdcb | 2012-02-10 21:07:25 +0000 | [diff] [blame] | 13 | printf(nullptr); |
| 14 | printf(*sp); // expected-warning {{not a string literal}} |
Hans Wennborg | 5294c79 | 2011-12-28 13:10:50 +0000 | [diff] [blame] | 15 | } |