mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-29 02:26:05 +00:00

bit by allowing __weak and __strong to be added/dropped as part of implicit conversions (qualification conversions in C++). A little history: GCC lets one add/remove/change GC qualifiers just about anywhere, implicitly. Clang did roughly the same before, but we recently normalized the semantics of qualifiers across the board to get a semantics that we could reason about (yay). Unfortunately, this tightened the screws a bit too much for GC qualifiers, where it's common to add/remove these qualifiers at will. Overall, we're still in better shape than we were before: we don't permit directly changing the GC qualifier (e.g., __weak -> __strong), so type safety is improved. More importantly, we're internally consistent in our handling of qualifiers, and the logic that allows adding/removing GC qualifiers (but not adding/removing address spaces!) only touches two obvious places. Fixes <rdar://problem/9402499>. llvm-svn: 131065
23 lines
604 B
Objective-C
23 lines
604 B
Objective-C
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-gc -fsyntax-only -verify %s
|
|
|
|
@interface A
|
|
@end
|
|
|
|
void f0(__strong A**); // expected-note{{passing argument to parameter here}}
|
|
|
|
void test_f0() {
|
|
A *a;
|
|
static __weak A *a2;
|
|
f0(&a);
|
|
f0(&a2); // expected-warning{{passing 'A *__weak *' to parameter of type 'A *__strong *' discards qualifiers}}
|
|
}
|
|
|
|
void f1(__weak A**); // expected-note{{passing argument to parameter here}}
|
|
|
|
void test_f1() {
|
|
A *a;
|
|
__strong A *a2;
|
|
f1(&a);
|
|
f1(&a2); // expected-warning{{passing 'A *__strong *' to parameter of type 'A *__weak *' discards qualifiers}}
|
|
}
|