diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java index 1859e3cfdfe..423fd5011a8 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java @@ -5375,6 +5375,26 @@ public class AST2TemplateTests extends AST2TestBase { assertSame(method, ((ICPPSpecialization) reference).getSpecializedBinding()); } + // template + // struct ostream { + // template + // ostream& operator<<(T); + // + // ostream& operator<<(ostream&(*)(ostream&)); + // }; + // + // template + // ostream& endl(ostream&); + // + // template + // void test(T t) { + // ostream out; + // out << t << endl; + // } + public void testInstantiationOfEndlInTemplate_417700() throws Exception { + parseAndCheckBindings(); + } + // template bool MySort(const T& a); // bool MySort(const int& a); // template void sort(V __comp); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPSemantics.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPSemantics.java index ecd3b3dbc9d..4bb8ffe430b 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPSemantics.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPSemantics.java @@ -2987,7 +2987,7 @@ public class CPPSemantics { } } } - if (targetType == null && parent instanceof IASTExpression + if (targetType == null && parent instanceof ICPPASTExpression && parent instanceof IASTImplicitNameOwner) { // Trigger resolution of overloaded operator, which may resolve the // function set. @@ -2995,6 +2995,12 @@ public class CPPSemantics { final IBinding newBinding = name.getPreBinding(); if (!(newBinding instanceof CPPFunctionSet)) return newBinding; + + // If we're in a dependent context, we don't have enough information + // to resolve the function set. + if (((ICPPASTExpression) parent).getEvaluation().isTypeDependent()) { + return CPPDeferredFunction.createForCandidates(functionSet.getBindings()); + } } ICPPFunction function = resolveTargetedFunction(targetType, functionSet, name);