Qualifiers AQuals = A.getQualifiers();
Qualifiers DeducedAQuals = DeducedA.getQualifiers();
+
+ // Under Objective-C++ ARC, the deduced type may have implicitly been
+ // given strong lifetime. If so, update the original qualifiers to
+ // include this strong lifetime.
+ if (S.getLangOpts().ObjCAutoRefCount &&
+ DeducedAQuals.getObjCLifetime() == Qualifiers::OCL_Strong &&
+ AQuals.getObjCLifetime() == Qualifiers::OCL_None) {
+ AQuals.setObjCLifetime(Qualifiers::OCL_Strong);
+ }
+
if (AQuals == DeducedAQuals) {
// Qualifiers match; there's nothing to do.
} else if (!DeducedAQuals.compatiblyIncludes(AQuals)) {
@interface A
@end
+@class NSString;
+
template<typename T, typename U>
struct is_same {
static const bool value = false;
float &fr = (f)(ap);
}
}
+
+namespace rdar10862386 {
+ // More deduction with lifetime qualifiers.
+ template <typename T>
+ int testing(const T &) {
+ return 1;
+ }
+
+ void test() {
+ testing(1);
+ testing("hi");
+ testing<NSString *>(@"hi");
+ testing(@"hi");
+ }
+}