From 952eddef9aff85b1e92626e89baaf7a360e2ac85 Mon Sep 17 00:00:00 2001 From: dim Date: Sun, 22 Dec 2013 00:07:40 +0000 Subject: Vendor import of clang release_34 branch r197841 (effectively, 3.4 RC3): https://llvm.org/svn/llvm-project/cfe/branches/release_34@197841 --- test/Sema/string-plus-char.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 test/Sema/string-plus-char.c (limited to 'test/Sema/string-plus-char.c') diff --git a/test/Sema/string-plus-char.c b/test/Sema/string-plus-char.c new file mode 100644 index 0000000..322e8f5 --- /dev/null +++ b/test/Sema/string-plus-char.c @@ -0,0 +1,15 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +void f(const char *s) { + char *str = 0; + char *str2 = str + 'c'; // expected-warning {{adding 'char' to a string pointer does not append to the string}} expected-note {{use array indexing to silence this warning}} + + const char *constStr = s + 'c'; // expected-warning {{adding 'char' to a string pointer does not append to the string}} expected-note {{use array indexing to silence this warning}} + + str = 'c' + str;// expected-warning {{adding 'char' to a string pointer does not append to the string}} expected-note {{use array indexing to silence this warning}} + + // no-warning + char c = 'c'; + str = str + c; + str = c + str; +} -- cgit v1.1