diff options
Diffstat (limited to 'test/SemaObjCXX')
-rw-r--r-- | test/SemaObjCXX/arc-system-header.mm | 3 | ||||
-rw-r--r-- | test/SemaObjCXX/foreach.mm | 16 | ||||
-rw-r--r-- | test/SemaObjCXX/property-reference.mm | 18 | ||||
-rw-r--r-- | test/SemaObjCXX/references.mm | 19 |
4 files changed, 51 insertions, 5 deletions
diff --git a/test/SemaObjCXX/arc-system-header.mm b/test/SemaObjCXX/arc-system-header.mm index 107b5b5..3358e5f 100644 --- a/test/SemaObjCXX/arc-system-header.mm +++ b/test/SemaObjCXX/arc-system-header.mm @@ -6,5 +6,4 @@ void f(A* a) { a->data.void_ptr = 0; a->data.a_b.b = 0; // expected-error{{'a_b' is unavailable: this system field has retaining ownership}} } -// Silly location below -// expected-note{{declaration has been explicitly marked unavailable here}} +// expected-note@arc-system-header.h:10{{declaration has been explicitly marked unavailable here}} diff --git a/test/SemaObjCXX/foreach.mm b/test/SemaObjCXX/foreach.mm index 3c4b908..d1302c1 100644 --- a/test/SemaObjCXX/foreach.mm +++ b/test/SemaObjCXX/foreach.mm @@ -12,8 +12,18 @@ void f(NSArray *a) { // expected-warning {{expression result unused}} for (id thisKey : keys); + + for (auto thisKey : keys) { } // expected-warning{{'auto' deduced as 'id' in declaration of 'thisKey'}} +} + +template<typename Collection> +void ft(Collection col) { + for (id x : col) { } + for (auto x : col) { } } +template void ft(NSArray *); + /* // rdar://9072298 */ @protocol NSObject @end @@ -59,3 +69,9 @@ void test2(NSObject<NSFastEnumeration> *collection) { // expected-warning {{property access result unused - getters should not be used for side effects}} } } + +void testErrors(NSArray *array) { + typedef int fn(int); + + for (fn x in array) { } // expected-error{{non-variable declaration in 'for' loop}} +} diff --git a/test/SemaObjCXX/property-reference.mm b/test/SemaObjCXX/property-reference.mm index b86ae5e..cfac9f3 100644 --- a/test/SemaObjCXX/property-reference.mm +++ b/test/SemaObjCXX/property-reference.mm @@ -57,3 +57,21 @@ template<typename T> void f() { } template void f<int>(); + +// rdar://13602832 +// +// Make sure that the default-argument checker looks through +// pseudo-object expressions correctly. The default argument +// needs to force l2r to test this effectively because the checker +// is syntactic and runs before placeholders are handled. +@interface Test13602832 +- (int) x; +@end +namespace test13602832 { + template <int N> void foo(Test13602832 *a, int limit = a.x + N) {} // expected-error {{default argument references parameter 'a'}} + + void test(Test13602832 *a) { + // FIXME: this is a useless cascade error. + foo<1024>(a); // expected-error {{no matching function}} + } +} diff --git a/test/SemaObjCXX/references.mm b/test/SemaObjCXX/references.mm index f63e17d..fa55207 100644 --- a/test/SemaObjCXX/references.mm +++ b/test/SemaObjCXX/references.mm @@ -1,5 +1,7 @@ -// RUN: %clang_cc1 -verify -emit-llvm -o - %s -// expected-no-diagnostics +// RUN: %clang_cc1 -verify -o - %s + +__attribute__((objc_root_class)) +@interface Root @end // Test reference binding. @@ -8,7 +10,7 @@ typedef struct { int f1; } T; -@interface A +@interface A : Root @property (assign) T p0; @property (assign) T& p1; @end @@ -61,3 +63,14 @@ void f6(baz* x) { f5d(ToBar()); (void)((foo&)ToBar()); } + +// rdar://13794269 +@interface B : Root @end +@implementation B { + unsigned bf : 4; // expected-note {{declared here}} +} + +- (void) foo { + unsigned &i = bf; // expected-error {{non-const reference cannot bind to bit-field 'bf'}} +} +@end |