Skip to main content
summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorMarkus Schorn2011-07-20 09:38:20 -0400
committerMarkus Schorn2011-07-20 09:45:38 -0400
commit5c46a13bd31fe7a9f5e19a629b965cb1ca66ea47 (patch)
tree5aa93033fd5e2151dc333f6aa1ff34f1c0515b84 /core
parent76b6692246a5b584c51a8a185b0e9ca5c49a9fca (diff)
downloadorg.eclipse.cdt-5c46a13bd31fe7a9f5e19a629b965cb1ca66ea47.tar.gz
org.eclipse.cdt-5c46a13bd31fe7a9f5e19a629b965cb1ca66ea47.tar.xz
org.eclipse.cdt-5c46a13bd31fe7a9f5e19a629b965cb1ca66ea47.zip
Bug 351927: Argument deduction with reference types
Diffstat (limited to 'core')
-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