mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-24 09:25:31 +02:00
Bug 422505 - Name resolution problem with template friend method
Change-Id: I1cb70755042572272cb38382795caa98f9d463ff Signed-off-by: Nathan Ridge <zeratul976@hotmail.com> Reviewed-on: https://git.eclipse.org/r/19825 Reviewed-by: Sergey Prigogin <eclipse.sprigogin@gmail.com> IP-Clean: Sergey Prigogin <eclipse.sprigogin@gmail.com> Tested-by: Sergey Prigogin <eclipse.sprigogin@gmail.com>
This commit is contained in:
parent
c126fade3d
commit
7f3095be51
2 changed files with 22 additions and 0 deletions
|
@ -8164,4 +8164,20 @@ public class AST2TemplateTests extends AST2TestBase {
|
|||
public void testSpecializedEnumerator_418770() throws Exception {
|
||||
parseAndCheckBindings();
|
||||
}
|
||||
|
||||
// template <typename T>
|
||||
// class A;
|
||||
//
|
||||
// namespace ns {
|
||||
// template <typename T>
|
||||
// int waldo(const A<T>&);
|
||||
// }
|
||||
//
|
||||
// template <typename T>
|
||||
// class A {
|
||||
// friend int ns::waldo<T>(const A<T>&);
|
||||
// };
|
||||
public void testDependentSpecializationOfFunctionTemplateAsFriend_422505() throws Exception {
|
||||
parseAndCheckBindings();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2648,6 +2648,12 @@ public class CPPSemantics {
|
|||
for (ICPPFunction fn : fns) {
|
||||
if (fn instanceof ICPPFunctionTemplate
|
||||
&& !(fn instanceof IProblemBinding) && !(fn instanceof ICPPUnknownBinding)) {
|
||||
// If the declared function type is dependent, there is no point trying to use it
|
||||
// to instantiate the template, so return a deferred function instead.
|
||||
// Note that CPPTemplates.instantiateForFunctionCall() behaves similarly.
|
||||
if (CPPTemplates.isDependentType(ft)) {
|
||||
return CPPDeferredFunction.createForCandidates(fns);
|
||||
}
|
||||
ICPPFunctionTemplate template= (ICPPFunctionTemplate) fn;
|
||||
ICPPFunction inst= CPPTemplates.instantiateForFunctionDeclaration(template, tmplArgs, ft, data.getLookupPoint());
|
||||
if (inst != null) {
|
||||
|
|
Loading…
Add table
Reference in a new issue