Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Ridge2019-08-23 22:35:30 -0400
committerNathan Ridge2019-08-31 21:24:35 -0400
commit15dbbb8304ce86c9ee01f566885e9cc0000387cf (patch)
tree8c18f41026d724add74bd71d3d9703dfebfc333a
parent77f853e077c62be0d8fa7d0f562f3d63b68105d3 (diff)
downloadorg.eclipse.cdt-15dbbb8304ce86c9ee01f566885e9cc0000387cf.tar.gz
org.eclipse.cdt-15dbbb8304ce86c9ee01f566885e9cc0000387cf.tar.xz
org.eclipse.cdt-15dbbb8304ce86c9ee01f566885e9cc0000387cf.zip
Bug 550397 - Fix a logic error in instantiateConversionTemplates()
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java18
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPTemplates.java3
2 files changed, 20 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 c42ac4dd8c..242b5ed5eb 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
@@ -4653,6 +4653,24 @@ public class AST2TemplateTests extends AST2CPPTestBase {
parseAndCheckBindings();
}
+ // class Mat {};
+ //
+ // template <typename T>
+ // class Mat_ {};
+ //
+ // class MatExpr {
+ // public:
+ // operator Mat();
+ //
+ // template <typename T>
+ // operator Mat_<T>();
+ // };
+ //
+ // Mat x = MatExpr();
+ public void testOverloadedConversionOperators_550397() throws Exception {
+ parseAndCheckImplicitNameBindings();
+ }
+
// template<unsigned int> struct ST{};
// template<template<unsigned int> class T> class CT {};
// typedef CT<ST> TDef;
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 07e27e0a23..96e1d2c47d 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
@@ -2455,8 +2455,9 @@ public class CPPTemplates {
result = new ICPPFunction[functions.length];
System.arraycopy(functions, 0, result, 0, i);
}
- result[i++] = inst;
+ result[i] = inst;
}
+ i++;
if (done)
break;
}

Back to the top