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:
parent
76b6692246
commit
5c46a13bd3
2 changed files with 24 additions and 2 deletions
|
@ -5416,4 +5416,22 @@ public class AST2TemplateTests extends AST2BaseTest {
|
||||||
public void testParameterAdjustementInInstantiatedFunctionType_351609() throws Exception {
|
public void testParameterAdjustementInInstantiatedFunctionType_351609() throws Exception {
|
||||||
parseAndCheckBindings();
|
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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -678,8 +678,12 @@ public class TemplateArgumentDeduction {
|
||||||
if (!(a instanceof ICPPReferenceType)) {
|
if (!(a instanceof ICPPReferenceType)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
p = ((ICPPReferenceType) p).getType();
|
final ICPPReferenceType rp = (ICPPReferenceType) p;
|
||||||
a = ((ICPPReferenceType) a).getType();
|
final ICPPReferenceType ra = (ICPPReferenceType) a;
|
||||||
|
if (ra.isRValueReference() != rp.isRValueReference())
|
||||||
|
return false;
|
||||||
|
p = rp.getType();
|
||||||
|
a = ra.getType();
|
||||||
} else if (p instanceof IArrayType) {
|
} else if (p instanceof IArrayType) {
|
||||||
if (!(a instanceof IArrayType)) {
|
if (!(a instanceof IArrayType)) {
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Add table
Reference in a new issue