Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Ridge2018-04-05 07:05:56 +0000
committerNathan Ridge2018-04-13 05:45:57 +0000
commit72d90351736e74f0e2860fc10e3b6bcc67a5fbce (patch)
treef1b516dc37223fdefcf87cc48938ddd82b9ef9df
parentff1cfbf1d4a01e1487ac8a76ebabee67552384c7 (diff)
downloadorg.eclipse.cdt-72d90351736e74f0e2860fc10e3b6bcc67a5fbce.tar.gz
org.eclipse.cdt-72d90351736e74f0e2860fc10e3b6bcc67a5fbce.tar.xz
org.eclipse.cdt-72d90351736e74f0e2860fc10e3b6bcc67a5fbce.zip
Bug 533216 - Correctly classify local types as dependent or not
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPTemplateResolutionTest.java21
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPTemplates.java6
2 files changed, 27 insertions, 0 deletions
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPTemplateResolutionTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPTemplateResolutionTest.java
index c5c65d39bf..5fedc936e1 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPTemplateResolutionTest.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPTemplateResolutionTest.java
@@ -3198,4 +3198,25 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
public void testConstexprInitListConstructor_519091() throws Exception {
checkBindings();
}
+
+ // template <typename T> T&& declval();
+ //
+ // template <typename Value, typename Func,
+ // typename Requires = decltype(declval<Func>()(declval<Value>()))>
+ // void apply(Value, Func);
+ //
+ // template <typename T>
+ // void callInTemplateContext(int i) {
+ // return apply(i, [](int x) { return T(x); });
+ // }
+ //
+ // void consume(int);
+ // void callInCpp1(int i);
+
+ // void callInCpp1(int i) {
+ // apply(i, &consume);
+ // }
+ public void testClassCastException_533216() throws Exception {
+ checkBindings();
+ }
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPTemplates.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPTemplates.java
index 845a3256fd..98574a7689 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPTemplates.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPTemplates.java
@@ -2973,6 +2973,12 @@ public class CPPTemplates {
return ((InitializerListType) t).getEvaluation().isTypeDependent();
} else if (t instanceof IBinding) {
IBinding owner = ((IBinding) t).getOwner();
+ if (owner instanceof IFunction) {
+ if (owner instanceof ICPPFunctionTemplate) {
+ return true;
+ }
+ owner = owner.getOwner();
+ }
if (owner instanceof ICPPClassTemplate)
return true;
return (owner instanceof IType) && owner != t && isDependentType((IType) owner);

Back to the top