1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Bug 351927: Argument deduction with reference types

This commit is contained in:
Markus Schorn 2011-07-20 15:38:20 +02:00
parent 76b6692246
commit 5c46a13bd3
2 changed files with 24 additions and 2 deletions

View file

@ -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();
}
}

View file

@ -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;