r178081 - <rdar://problem/13473493> Handle 'this->' insertion recovery within trailing return types.
Douglas Gregor
dgregor at apple.com
Tue Mar 26 15:43:55 PDT 2013
Author: dgregor
Date: Tue Mar 26 17:43:55 2013
New Revision: 178081
URL: http://llvm.org/viewvc/llvm-project?rev=178081&view=rev
Log:
<rdar://problem/13473493> Handle 'this->' insertion recovery within trailing return types.
Modified:
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/test/CXX/expr/expr.prim/expr.prim.general/p3-0x.cpp
Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=178081&r1=178080&r2=178081&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Tue Mar 26 17:43:55 2013
@@ -1563,9 +1563,10 @@ bool Sema::DiagnoseEmptyLookup(Scope *S,
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());
Modified: cfe/trunk/test/CXX/expr/expr.prim/expr.prim.general/p3-0x.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/expr/expr.prim/expr.prim.general/p3-0x.cpp?rev=178081&r1=178080&r2=178081&view=diff
==============================================================================
--- cfe/trunk/test/CXX/expr/expr.prim/expr.prim.general/p3-0x.cpp (original)
+++ cfe/trunk/test/CXX/expr/expr.prim/expr.prim.general/p3-0x.cpp Tue Mar 26 17:43:55 2013
@@ -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)>'}}
+ }
+}
More information about the cfe-commits
mailing list