[cfe-commits] r132744 - in /cfe/trunk: lib/Sema/SemaOverload.cpp test/SemaTemplate/dependent-names-no-std.cpp

Chandler Carruth chandlerc at gmail.com
Wed Jun 8 03:13:18 PDT 2011


Author: chandlerc
Date: Wed Jun  8 05:13:17 2011
New Revision: 132744

URL: http://llvm.org/viewvc/llvm-project?rev=132744&view=rev
Log:
Fix a regression in the two-phase lookup diagnostics that switching the
namespace set algorithm (re-)introduced. We may not have seen the 'std'
namespace, but we should still suggested associated namespaces. Easy
fix, but a bit annoying to test.

Added:
    cfe/trunk/test/SemaTemplate/dependent-names-no-std.cpp
Modified:
    cfe/trunk/lib/Sema/SemaOverload.cpp

Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=132744&r1=132743&r2=132744&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Wed Jun  8 05:13:17 2011
@@ -7881,6 +7881,9 @@
           if (!Std->Encloses(*it))
             SuggestedNamespaces.insert(*it);
         }
+      } else {
+        // Lacking the 'std::' namespace, use all of the associated namespaces.
+        SuggestedNamespaces = AssociatedNamespaces;
       }
 
       SemaRef.Diag(R.getNameLoc(), diag::err_not_found_by_two_phase_lookup)

Added: cfe/trunk/test/SemaTemplate/dependent-names-no-std.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/dependent-names-no-std.cpp?rev=132744&view=auto
==============================================================================
--- cfe/trunk/test/SemaTemplate/dependent-names-no-std.cpp (added)
+++ cfe/trunk/test/SemaTemplate/dependent-names-no-std.cpp Wed Jun  8 05:13:17 2011
@@ -0,0 +1,21 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+//
+// The whole point of this test is to verify certain diagnostics work in the
+// absence of namespace 'std'.
+
+namespace PR10053 {
+  namespace ns {
+    struct Data {};
+  }
+
+  template<typename T> struct A {
+    T t;
+    A() {
+      f(t); // expected-error {{call to function 'f' that is neither visible in the template definition nor found by argument dependent lookup}}
+    }
+  };
+
+  void f(ns::Data); // expected-note {{in namespace 'PR10053::ns'}}
+
+  A<ns::Data> a; // expected-note {{in instantiation of member function}}
+}





More information about the cfe-commits mailing list