summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Ridge2013-12-15 02:03:34 (EST)
committer Sergey Prigogin2013-12-16 00:55:50 (EST)
commitdd7dde956f0c260a24b0fc793fb0246b51f24685 (patch)
treeba1633aefe4e737729f00f9ef9a6a83c466aced5
parentd96ec1dfc888365e61f5b02671d6b0fbb50650b5 (diff)
downloadorg.eclipse.cdt-dd7dde956f0c260a24b0fc793fb0246b51f24685.zip
org.eclipse.cdt-dd7dde956f0c260a24b0fc793fb0246b51f24685.tar.gz
org.eclipse.cdt-dd7dde956f0c260a24b0fc793fb0246b51f24685.tar.bz2
Bug 417700 - Semantic Error: Invalid overload of 'endl' for a templatedrefs/changes/34/19834/3
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>
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java20
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPSemantics.java8
2 files changed, 27 insertions, 1 deletions
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 1859e3c..423fd50 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 <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);
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 ecd3b3d..4bb8ffe 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);