ExDeclType, TInfo, SC_None, SC_None);
ExDecl->setExceptionVariable(true);
+ // In ARC, infer 'retaining' for variables of retainable type.
+ if (getLangOptions().ObjCAutoRefCount && inferObjCARCLifetime(ExDecl))
+ Invalid = true;
+
if (!Invalid && !ExDeclType->isDependentType()) {
if (const RecordType *recordType = ExDeclType->getAs<RecordType>()) {
// C++ [except.handle]p16:
T, TInfo, SC_None, SC_None);
New->setExceptionVariable(true);
+ // In ARC, infer 'retaining' for variables of retainable type.
+ if (getLangOptions().ObjCAutoRefCount && inferObjCARCLifetime(New))
+ Invalid = true;
+
if (Invalid)
New->setInvalidDecl();
return New;
Sema::LookupOrdinaryName, Sema::ForRedeclaration);
if (D->isStaticDataMember())
SemaRef.LookupQualifiedName(Previous, Owner, false);
+
+ // In ARC, infer 'retaining' for variables of retainable type.
+ if (SemaRef.getLangOptions().ObjCAutoRefCount &&
+ SemaRef.inferObjCARCLifetime(Var))
+ Var->setInvalidDecl();
+
SemaRef.CheckVariableDeclaration(Var, Previous);
if (D->isOutOfLine()) {
// Template instantiation side of rdar://problem/9817306
@interface Test37
++ alloc;
+- init;
- (NSArray *) array;
@end
template <class T> void test37(T *a) {
// CHECK-NEXT: call void @objc_release
// CHECK-NEXT: ret void
template void send_release<int>();
+
+template<typename T>
+Test37 *instantiate_init() {
+ Test37 *result = [[Test37 alloc] init];
+ return result;
+}
+
+// CHECK: define weak_odr %2* @_Z16instantiate_initIiEP6Test37v
+// CHECK: call i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend
+// CHECK: call i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend
+// CHECK: call i8* @objc_retain
+// CHECK: call void @objc_release
+// CHECK: call i8* @objc_autoreleaseReturnValue
+template Test37* instantiate_init<int>();
+