1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 22:52:11 +02:00

Bug 501549 - Unresolved symbol with lambda

Change-Id: Ic541e9a7ea4338aa0515705047f5fb614150d074
This commit is contained in:
Sergey Prigogin 2016-09-20 13:08:35 -07:00
parent fa96519c4c
commit 2a4e3e11e4
2 changed files with 55 additions and 3 deletions

View file

@ -6060,6 +6060,34 @@ public class AST2TemplateTests extends AST2TestBase {
parseAndCheckBindings();
}
// template<typename T>
// T d();
//
// template <typename U>
// static decltype(&U::operator()) c(U* p);
//
// template <typename F>
// decltype(c<F>(d<F*>()))* waldo(F f);
//
// template <typename T, typename U = decltype(&T::m)>
// struct B {};
//
// template <typename T, typename R, typename P>
// struct B<T, R (*)(P)> {
// R operator()(P p);
// };
//
// struct A {
// static void m(int p);
// };
//
// void test() {
// waldo([]() { return B<A>(); }());
// }
public void testTemplateArgumentDeductionWithFunctionSet_501549() throws Exception {
parseAndCheckBindings();
}
// template<bool V, typename T>
// struct C {
// typedef int s;

View file

@ -932,9 +932,33 @@ public class TemplateArgumentDeduction {
remaining.isRestrict());
}
} else if (p instanceof ICPPFunctionType) {
if (!(a instanceof ICPPFunctionType))
ICPPFunctionType ftp = (ICPPFunctionType) p;
if (a instanceof ICPPFunctionType)
return fromFunctionType(ftp, (ICPPFunctionType) a, point);
if (a instanceof FunctionSetType) {
// 14.8.2.1-6 Handling of overloaded function sets.
CPPTemplateParameterMap success = null;
ICPPFunction[] fs= ((FunctionSetType) a).getFunctionSet().getBindings();
for (ICPPFunction f : fs) {
ICPPFunctionType fta = f.getType();
final CPPTemplateParameterMap saved = saveState();
try {
if (fromFunctionType(ftp, fta, point)) {
if (success != null)
return false;
success = saveState();
}
} finally {
restoreState(saved);
}
}
if (success != null) {
restoreState(success);
return true;
}
}
return false;
return fromFunctionType((ICPPFunctionType) p, (ICPPFunctionType) a, point);
} else if (p instanceof ICPPTemplateParameter) {
ICPPTemplateArgument current=
fDeducedArgs.getArgument(((ICPPTemplateParameter) p).getParameterID(), fPackOffset);