Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Ridge2019-11-19 21:28:15 -0500
committerNathan Ridge2019-11-19 21:28:15 -0500
commit7e267a47915bb79d384528be5be713e6fd3c10fd (patch)
treeb3c968c1c1491ed5b620766a2232b61702debe79
parentac7d473351cbc88d0724230b9ceed550ffd37791 (diff)
downloadorg.eclipse.cdt-7e267a47915bb79d384528be5be713e6fd3c10fd.tar.gz
org.eclipse.cdt-7e267a47915bb79d384528be5be713e6fd3c10fd.tar.xz
org.eclipse.cdt-7e267a47915bb79d384528be5be713e6fd3c10fd.zip
Bug 553141 - Fix logic error in TypeInstantiationRequest.equals()
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/cxx17/TemplateAutoTests.java33
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/TypeInstantiationRequest.java2
2 files changed, 34 insertions, 1 deletions
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/cxx17/TemplateAutoTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/cxx17/TemplateAutoTests.java
index 17d86ac772..c44bce5433 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/cxx17/TemplateAutoTests.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/cxx17/TemplateAutoTests.java
@@ -75,4 +75,37 @@ public class TemplateAutoTests extends AST2CPPTestBase {
public void testTemplateNontypeParameterTypeDeductionParsing_519361_3() throws Exception {
parseAndCheckBindings();
}
+
+ // template <typename T, T>
+ // struct meta { using type = int; };
+ //
+ // template <typename T>
+ // struct remove_noexcept { using type = T; };
+ //
+ // template <typename T>
+ // using remove_noexcept_t = typename remove_noexcept<T>::type;
+ //
+ // template <auto Key>
+ // struct K : meta<remove_noexcept_t<decltype(Key)>,Key>{};
+ //
+ // template <auto Key>
+ // struct W {
+ // using type = typename K<Key>::type;
+ // };
+ //
+ // template <typename T>
+ // struct M {};
+ //
+ // struct A {
+ // int foo;
+ // };
+ // typedef M<W<&A::foo>::type> M1; // typedef #1
+ //
+ // struct B {
+ // int foo;
+ // };
+ // typedef M<W<&B::foo>::type> M2; // typedef #2
+ public void testInstantiationCacheConflict_553141() throws Exception {
+ parseAndCheckBindings();
+ }
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/TypeInstantiationRequest.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/TypeInstantiationRequest.java
index e667de7196..96d652981f 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/TypeInstantiationRequest.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/TypeInstantiationRequest.java
@@ -80,7 +80,7 @@ public class TypeInstantiationRequest {
return true;
if (type1 == null || type2 == null)
return false;
- return type1.isSameType(type1);
+ return type1.isSameType(type2);
}
private boolean equals(ICPPTemplateParameterMap map1, ICPPTemplateParameterMap map2) {

Back to the top