Objective-C++: The global namespace is an associated namespace of an

Objective-C pointer type. Fixes <rdar://problem/9142559>.

llvm-svn: 129339
This commit is contained in:
Douglas Gregor 2011-04-12 01:02:45 +00:00
parent fbc5a4004c
commit 8e93666a71
2 changed files with 23 additions and 1 deletions

View File

@ -1963,10 +1963,13 @@ addAssociatedClassesAndNamespaces(AssociatedLookup &Result, QualType Ty) {
case Type::Complex:
break;
// These are ignored by ADL.
// If T is an Objective-C object or interface type, or a pointer to an
// object or interface type, the associated namespace is the global
// namespace.
case Type::ObjCObject:
case Type::ObjCInterface:
case Type::ObjCObjectPointer:
Result.Namespaces.insert(Result.S.Context.getTranslationUnitDecl());
break;
}

View File

@ -0,0 +1,19 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
// <rdar://problem/9142559>: For the purposes of Argument-Dependent
// Lookup, Objective-C classes are considered to be in the global
// namespace.
@interface NSFoo
@end
template<typename T>
void f(T t) {
g(t);
}
void g(NSFoo*);
void test(NSFoo *foo) {
f(foo);
}