[cfe-commits] r129339 - in /cfe/trunk: lib/Sema/SemaLookup.cpp test/SemaObjCXX/argument-dependent-lookup.mm
Douglas Gregor
dgregor at apple.com
Mon Apr 11 18:02:45 PDT 2011
Author: dgregor
Date: Mon Apr 11 20:02:45 2011
New Revision: 129339
URL: http://llvm.org/viewvc/llvm-project?rev=129339&view=rev
Log:
Objective-C++: The global namespace is an associated namespace of an
Objective-C pointer type. Fixes <rdar://problem/9142559>.
Added:
cfe/trunk/test/SemaObjCXX/argument-dependent-lookup.mm
Modified:
cfe/trunk/lib/Sema/SemaLookup.cpp
Modified: cfe/trunk/lib/Sema/SemaLookup.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaLookup.cpp?rev=129339&r1=129338&r2=129339&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaLookup.cpp (original)
+++ cfe/trunk/lib/Sema/SemaLookup.cpp Mon Apr 11 20:02:45 2011
@@ -1963,10 +1963,13 @@
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;
}
Added: cfe/trunk/test/SemaObjCXX/argument-dependent-lookup.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjCXX/argument-dependent-lookup.mm?rev=129339&view=auto
==============================================================================
--- cfe/trunk/test/SemaObjCXX/argument-dependent-lookup.mm (added)
+++ cfe/trunk/test/SemaObjCXX/argument-dependent-lookup.mm Mon Apr 11 20:02:45 2011
@@ -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.
+
+ at interface NSFoo
+ at end
+
+template<typename T>
+void f(T t) {
+ g(t);
+}
+
+void g(NSFoo*);
+
+void test(NSFoo *foo) {
+ f(foo);
+}
More information about the cfe-commits
mailing list