<rdar://problem/13473493> Handle 'this->' insertion recovery within trailing return...
authorDouglas Gregor <dgregor@apple.com>
Tue, 26 Mar 2013 22:43:55 +0000 (22:43 +0000)
committerDouglas Gregor <dgregor@apple.com>
Tue, 26 Mar 2013 22:43:55 +0000 (22:43 +0000)
llvm-svn: 178081

clang/lib/Sema/SemaExpr.cpp
clang/test/CXX/expr/expr.prim/expr.prim.general/p3-0x.cpp

index 4ba1d0d..c0b1ad1 100644 (file)
@@ -1563,9 +1563,10 @@ bool Sema::DiagnoseEmptyLookup(Scope *S, CXXScopeSpec &SS, LookupResult &R,
           UnresolvedLookupExpr *ULE = cast<UnresolvedLookupExpr>(
               CallsUndergoingInstantiation.back()->getCallee());
 
-          
           CXXMethodDecl *DepMethod;
-          if (CurMethod->getTemplatedKind() ==
+          if (CurMethod->isDependentContext())
+            DepMethod = CurMethod;
+          else if (CurMethod->getTemplatedKind() ==
               FunctionDecl::TK_FunctionTemplateSpecialization)
             DepMethod = cast<CXXMethodDecl>(CurMethod->getPrimaryTemplate()->
                 getInstantiatedFromMemberTemplate()->getTemplatedDecl());
index 2e7b58d..6657991 100644 (file)
@@ -116,3 +116,23 @@ namespace PR12564 {
     void foo(Derived& d) noexcept(noexcept(d.bar(d))) {} // expected-error {{cannot bind to a value of unrelated type}}
   };
 }
+
+namespace rdar13473493 {
+  template <typename F>
+  class wrap
+  {
+  public:
+    template <typename... Args>
+    auto operator()(Args&&... args) const -> decltype(wrapped(args...)) // expected-note{{candidate template ignored: substitution failure [with Args = <int>]: use of undeclared identifier 'wrapped'}}
+    {
+      return wrapped(args...);
+    }
+  
+  private:
+    F wrapped;
+  };
+
+  void test(wrap<int (*)(int)> w) {
+    w(5); // expected-error{{no matching function for call to object of type 'wrap<int (*)(int)>'}}
+  }
+}