102debf605cd904edac8dceb196e5f142ce3d14ebJordan Rose// RUN: %clang_cc1 -fsyntax-only -verify %s 202debf605cd904edac8dceb196e5f142ce3d14ebJordan Rose 302debf605cd904edac8dceb196e5f142ce3d14ebJordan Rosevoid f(const char *s) { 402debf605cd904edac8dceb196e5f142ce3d14ebJordan Rose char *str = 0; 502debf605cd904edac8dceb196e5f142ce3d14ebJordan Rose 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}} 602debf605cd904edac8dceb196e5f142ce3d14ebJordan Rose 702debf605cd904edac8dceb196e5f142ce3d14ebJordan Rose 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}} 802debf605cd904edac8dceb196e5f142ce3d14ebJordan Rose 902debf605cd904edac8dceb196e5f142ce3d14ebJordan Rose 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}} 1002debf605cd904edac8dceb196e5f142ce3d14ebJordan Rose 1102debf605cd904edac8dceb196e5f142ce3d14ebJordan Rose // no-warning 1202debf605cd904edac8dceb196e5f142ce3d14ebJordan Rose char c = 'c'; 1302debf605cd904edac8dceb196e5f142ce3d14ebJordan Rose str = str + c; 1402debf605cd904edac8dceb196e5f142ce3d14ebJordan Rose str = c + str; 1502debf605cd904edac8dceb196e5f142ce3d14ebJordan Rose} 16