blob: 322e8f5962be3b62a0365ac63bed0299e42dd5e1 [file] [log] [blame]
Jordan Rose55659412013-10-25 16:52:00 +00001// RUN: %clang_cc1 -fsyntax-only -verify %s
2
3void f(const char *s) {
4 char *str = 0;
5 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}}
6
7 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}}
8
9 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}}
10
11 // no-warning
12 char c = 'c';
13 str = str + c;
14 str = c + str;
15}