Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPTemplateResolutionTest.java39
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/TemplateArgumentDeduction.java5
2 files changed, 43 insertions, 1 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 db5016d71d..4653d56350 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
@@ -1182,6 +1182,45 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
assertEquals("int", ASTTypeUtil.getType(type));
}
+ // template <typename T>
+ // struct D;
+ //
+ // template <typename C, typename U>
+ // struct D<void (C::*)(U)> {
+ // typedef U type;
+ // };
+ //
+ // template <typename T>
+ // using E = typename D<decltype(&T::operator())>::type;
+ //
+ // template <typename T>
+ // struct G {
+ // typedef E<T> type;
+ // };
+ //
+ // template <typename T>
+ // using F = typename G<T>::type;
+ //
+ // template <typename T, typename U>
+ // struct B {};
+ //
+ // template <typename T>
+ // B<F<T>, int>* f(T t);
+ //
+ // template <typename U>
+ // void waldo(B<double, U>* e);
+
+ // struct A {
+ // void operator()(double x);
+ // };
+ //
+ // void test() {
+ // waldo(f(A()));
+ // }
+ public void testTemplateArgumentDeduction_507511() throws Exception {
+ checkBindings();
+ }
+
// class A {}; class B {}; class X {};
// template<typename T>
// class C {
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/TemplateArgumentDeduction.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/TemplateArgumentDeduction.java
index 5cbe5b334c..5995218080 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/TemplateArgumentDeduction.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/TemplateArgumentDeduction.java
@@ -836,7 +836,10 @@ public class TemplateArgumentDeduction {
return tval.equals(sval);
}
- return fromType(p.getTypeValue(), a.getOriginalTypeValue(), false, point);
+ // Try to deduce from the original argument type, but if it fails, fall back to the simplified
+ // argument type.
+ return fromType(p.getTypeValue(), a.getOriginalTypeValue(), false, point)
+ || fromType(p.getTypeValue(), a.getTypeValue(), false, point);
}
private boolean fromType(IType p, IType a, boolean allowCVQConversion, IASTNode point) throws DOMException {

Back to the top