summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/Sema/format-strings.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/clang/test/Sema/format-strings.c b/clang/test/Sema/format-strings.c
index 5007bb0fa40..9237a5970e9 100644
--- a/clang/test/Sema/format-strings.c
+++ b/clang/test/Sema/format-strings.c
@@ -99,3 +99,17 @@ void __attribute__((format(printf,1,3))) myprintf(const char*, int blah, ...);
void test_myprintf() {
myprintf("%d", 17, 18); // okay
}
+
+void test_constant_bindings(void) {
+ const char * const s1 = "hello";
+ const char s2[] = "hello";
+ const char *s3 = "hello";
+ char * const s4 = "hello";
+ extern const char s5[];
+
+ printf(s1); // no-warning
+ printf(s2); // no-warning
+ printf(s3); // expected-warning{{not a string literal}}
+ printf(s4); // expected-warning{{not a string literal}}
+ printf(s5); // expected-warning{{not a string literal}}
+}
OpenPOWER on IntegriCloud