Home | History | Annotate | Download | only in SemaObjCXX
      1 // RUN: %clang_cc1 -std=c++11 -fsyntax-only -fobjc-arc -verify -fblocks -fobjc-exceptions %s
      2 
      3 // "Move" semantics, trivial version.
      4 void move_it(__strong id &&from) {
      5   id to = static_cast<__strong id&&>(from);
      6 }
      7 
      8 // Deduction with 'auto'.
      9 @interface A
     10 + alloc;
     11 - init;
     12 @end
     13 
     14 // Ensure that deduction works with lifetime qualifiers.
     15 void deduction(id obj) {
     16   auto a = [[A alloc] init];
     17   __strong A** aPtr = &a;
     18 
     19   auto a2([[A alloc] init]);
     20   __strong A** aPtr2 = &a2;
     21 
     22   __strong id *idp = new auto(obj);
     23 
     24   __strong id array[17];
     25   for (auto x : array) {
     26     __strong id *xPtr = &x;
     27   }
     28 
     29   @try {
     30   } @catch (auto e) { // expected-error {{'auto' not allowed in exception declaration}}
     31   }
     32 }
     33