Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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/TemplateArgumentDeduction.java8
2 files changed, 24 insertions, 2 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 3e1bc2db25..fc1b4bcd99 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
@@ -5416,4 +5416,22 @@ public class AST2TemplateTests extends AST2BaseTest {
public void testParameterAdjustementInInstantiatedFunctionType_351609() throws Exception {
parseAndCheckBindings();
}
+
+ // template<typename T> struct CT {
+ // int g;
+ // };
+ // template<typename T> struct CT<T&> {
+ // int ref;
+ // };
+ // template<typename T> struct CT<T&&> {
+ // int rref;
+ // };
+ // void test() {
+ // CT<int>::g;
+ // CT<int&>::ref;
+ // CT<int&&>::rref;
+ // }
+ public void testRRefVsRef_351927() throws Exception {
+ parseAndCheckBindings();
+ }
}
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 021c2faaa8..be23516639 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
@@ -678,8 +678,12 @@ public class TemplateArgumentDeduction {
if (!(a instanceof ICPPReferenceType)) {
return false;
}
- p = ((ICPPReferenceType) p).getType();
- a = ((ICPPReferenceType) a).getType();
+ final ICPPReferenceType rp = (ICPPReferenceType) p;
+ final ICPPReferenceType ra = (ICPPReferenceType) a;
+ if (ra.isRValueReference() != rp.isRValueReference())
+ return false;
+ p = rp.getType();
+ a = ra.getType();
} else if (p instanceof IArrayType) {
if (!(a instanceof IArrayType)) {
return false;

Back to the top