
This brings our tree to NetBSD 7.0, as found on -current on the 10-10-2015. This updates: - LLVM to 3.6.1 - GCC to GCC 5.1 - Replace minix/commands/zdump with usr.bin/zdump - external/bsd/libelf has moved to /external/bsd/elftoolchain/ - Import ctwm - Drop sprintf from libminc Change-Id: I149836ac18e9326be9353958bab9b266efb056f0
31 lines
1.5 KiB
C
31 lines
1.5 KiB
C
// RUN: %clang_cc1 -fsyntax-only -verify %s
|
|
|
|
struct AB{const char *a; const char*b;};
|
|
|
|
const char *foo(const struct AB *ab) {
|
|
return ab->a + 'b'; // expected-warning {{adding 'char' to a string pointer does not append to the string}} expected-note {{use array indexing to silence this warning}}
|
|
}
|
|
|
|
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}}
|
|
|
|
char strArr[] = "foo";
|
|
str = strArr + 'c'; // expected-warning {{adding 'char' to a string pointer does not append to the string}} expected-note {{use array indexing to silence this warning}}
|
|
char *strArr2[] = {"ac","dc"};
|
|
str = strArr2[0] + 'c'; // expected-warning {{adding 'char' to a string pointer does not append to the string}} expected-note {{use array indexing to silence this warning}}
|
|
|
|
|
|
struct AB ab;
|
|
constStr = foo(&ab) + 'c'; // 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;
|
|
}
|