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:
parent
fa96519c4c
commit
2a4e3e11e4
2 changed files with 55 additions and 3 deletions
|
@ -6060,6 +6060,34 @@ public class AST2TemplateTests extends AST2TestBase {
|
||||||
parseAndCheckBindings();
|
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>
|
// template<bool V, typename T>
|
||||||
// struct C {
|
// struct C {
|
||||||
// typedef int s;
|
// typedef int s;
|
||||||
|
|
|
@ -932,9 +932,33 @@ public class TemplateArgumentDeduction {
|
||||||
remaining.isRestrict());
|
remaining.isRestrict());
|
||||||
}
|
}
|
||||||
} else if (p instanceof ICPPFunctionType) {
|
} else if (p instanceof ICPPFunctionType) {
|
||||||
if (!(a instanceof ICPPFunctionType))
|
ICPPFunctionType ftp = (ICPPFunctionType) p;
|
||||||
return false;
|
if (a instanceof ICPPFunctionType)
|
||||||
return fromFunctionType((ICPPFunctionType) p, (ICPPFunctionType) a, point);
|
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;
|
||||||
} else if (p instanceof ICPPTemplateParameter) {
|
} else if (p instanceof ICPPTemplateParameter) {
|
||||||
ICPPTemplateArgument current=
|
ICPPTemplateArgument current=
|
||||||
fDeducedArgs.getArgument(((ICPPTemplateParameter) p).getParameterID(), fPackOffset);
|
fDeducedArgs.getArgument(((ICPPTemplateParameter) p).getParameterID(), fPackOffset);
|
||||||
|
|
Loading…
Add table
Reference in a new issue