diff options
Diffstat (limited to 'clang/test/Sema/format-strings-c90.c')
-rw-r--r-- | clang/test/Sema/format-strings-c90.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/clang/test/Sema/format-strings-c90.c b/clang/test/Sema/format-strings-c90.c index 74e5fb17ccf..678a6ef373a 100644 --- a/clang/test/Sema/format-strings-c90.c +++ b/clang/test/Sema/format-strings-c90.c @@ -1,4 +1,4 @@ -/* RUN: %clang_cc1 -fsyntax-only -verify -pedantic -std=c89 %s +/* RUN: %clang_cc1 -fsyntax-only -verify -triple i386-apple-darwin9 -pedantic -std=c89 %s */ int scanf(const char * restrict, ...); @@ -19,4 +19,9 @@ void foo(char **sp, float *fp, int *ip) { printf("%afoo", 1.0); scanf("%da", ip); + + /* Test argument type check for the 'a' length modifier. */ + scanf("%as", fp); /* expected-warning{{conversion specifies type 'char **' but the argument has type 'float *'}} */ + scanf("%aS", fp); /* expected-warning{{conversion specifies type 'wchar_t **' (aka 'int **') but the argument has type 'float *'}} */ + scanf("%a[abc]", fp); /* expected-warning{{conversion specifies type 'char **' but the argument has type 'float *'}} */ } |