mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-02-21 10:42:35 +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
30 lines
1.0 KiB
Objective-C
30 lines
1.0 KiB
Objective-C
// RUN: %clang_cc1 -fsyntax-only -verify %s
|
|
|
|
@interface A
|
|
@end
|
|
@interface B
|
|
@end
|
|
|
|
void f0(int cond, A *a, B *b) {
|
|
// Ensure that we can still send a message to result of incompatible
|
|
// conditional expression.
|
|
[ (cond ? a : b) test ]; // expected-warning{{incompatible operand types ('A *' and 'B *')}} expected-warning {{method '-test' not found}}
|
|
}
|
|
|
|
@interface NSKey @end
|
|
@interface KeySub : NSKey @end
|
|
|
|
@interface UpdatesList @end
|
|
|
|
void foo (int i, NSKey *NSKeyValueCoding_NullValue, UpdatesList *nukedUpdatesList)
|
|
{
|
|
id obj;
|
|
NSKey *key;
|
|
KeySub *keysub;
|
|
|
|
obj = i ? NSKeyValueCoding_NullValue : nukedUpdatesList; // expected-warning{{incompatible operand types ('NSKey *' and 'UpdatesList *')}}
|
|
key = i ? NSKeyValueCoding_NullValue : nukedUpdatesList; // expected-warning{{incompatible operand types ('NSKey *' and 'UpdatesList *')}}
|
|
key = i ? NSKeyValueCoding_NullValue : keysub;
|
|
keysub = i ? NSKeyValueCoding_NullValue : keysub; // expected-warning{{incompatible pointer types assigning to 'KeySub *' from 'NSKey *'}}
|
|
}
|