1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-22 14:12:10 +02:00

Bug 417700 - Semantic Error: Invalid overload of 'endl' for a templated

parameter

Change-Id: Icd110a386421d9d5cc9502dd8d4cd56328119a77
Signed-off-by: Nathan Ridge <zeratul976@hotmail.com>
Reviewed-on: https://git.eclipse.org/r/19834
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:
Nathan Ridge 2013-12-15 02:03:34 -05:00 committed by Sergey Prigogin
parent d96ec1dfc8
commit dd7dde956f
2 changed files with 27 additions and 1 deletions

View file

@ -5375,6 +5375,26 @@ public class AST2TemplateTests extends AST2TestBase {
assertSame(method, ((ICPPSpecialization) reference).getSpecializedBinding());
}
// template <typename CharT>
// struct ostream {
// template <typename T>
// ostream& operator<<(T);
//
// ostream& operator<<(ostream&(*)(ostream&));
// };
//
// template <typename CharT>
// ostream<CharT>& endl(ostream<CharT>&);
//
// template <typename T>
// void test(T t) {
// ostream<char> out;
// out << t << endl;
// }
public void testInstantiationOfEndlInTemplate_417700() throws Exception {
parseAndCheckBindings();
}
// template<typename T> bool MySort(const T& a);
// bool MySort(const int& a);
// template<typename V> void sort(V __comp);

View file

@ -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);