mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-28 15:06:08 +00:00

destination type for initialization, assignment, parameter-passing, etc. The main issue fixed here is that we used rather confusing wording for diagnostics such as t.c:2:9: warning: initializing 'char const [2]' discards qualifiers, expected 'char *' [-pedantic] char *name = __func__; ^ ~~~~~~~~ We're not initializing a 'char const [2]', we're initializing a 'char *' with an expression of type 'char const [2]'. Similar problems existed for other diagnostics in this area, so I've normalized them all with more precise descriptive text to say what we're initializing/converting/assigning/etc. from and to. The warning for the code above is now: t.c:2:9: warning: initializing 'char *' from an expression of type 'char const [2]' discards qualifiers [-pedantic] char *name = __func__; ^ ~~~~~~~~ Fixes <rdar://problem/7447179>. llvm-svn: 100832
12 lines
398 B
C
12 lines
398 B
C
// RUN: %clang_cc1 %s -verify -pedantic
|
|
typedef int unary_int_func(int arg);
|
|
unary_int_func *func;
|
|
|
|
unary_int_func *set_func(void *p) {
|
|
func = p; // expected-warning {{converts between void pointer and function pointer}}
|
|
p = func; // expected-warning {{converts between void pointer and function pointer}}
|
|
|
|
return p; // expected-warning {{converts between void pointer and function pointer}}
|
|
}
|
|
|