1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-10 17:55:39 +02:00

Bug 309564: Partial ordering of template funcitons.

This commit is contained in:
Markus Schorn 2010-04-26 14:03:29 +00:00
parent c038f8b53e
commit f210a17908
2 changed files with 6 additions and 2 deletions

View file

@ -2285,7 +2285,7 @@ public class AST2TemplateTests extends AST2BaseTest {
// void test(int* x) { // void test(int* x) {
// f<int>(x); // f<int>(x);
// } // }
public void _testFunctionTemplate_309564() throws Exception { public void testFunctionTemplate_309564() throws Exception {
final String code = getAboveComment(); final String code = getAboveComment();
parseAndCheckBindings(code); parseAndCheckBindings(code);
} }

View file

@ -211,7 +211,7 @@ public class TemplateArgumentDeduction {
// 14.8.2.1-2 // 14.8.2.1-2
if (par instanceof ICPPReferenceType) { if (par instanceof ICPPReferenceType) {
// If P is an rvalue reference to a cv-unqualified template parameter and the argument is an // If P is an rvalue reference to a cv-unqualified template parameter and the argument is an
// lvalue, the type A& lvalue reference to A is used in place of A for type deduction. // lvalue, the type "lvalue reference to A" is used in place of A for type deduction.
isReferenceTypeParameter= true; isReferenceTypeParameter= true;
final ICPPReferenceType refPar = (ICPPReferenceType) par; final ICPPReferenceType refPar = (ICPPReferenceType) par;
if (refPar.isRValueReference() && refPar.getType() instanceof ICPPTemplateParameter && argIsLValue.get(j)) { if (refPar.isRValueReference() && refPar.getType() instanceof ICPPTemplateParameter && argIsLValue.get(j)) {
@ -275,6 +275,10 @@ public class TemplateArgumentDeduction {
} }
} }
} }
// Bug 309564: For partial ordering not all arguments need to be deduced
if (checkExactMatch)
return true;
if (!deduct.fExplicitArgs.mergeToExplicit(deduct.fDeducedArgs)) if (!deduct.fExplicitArgs.mergeToExplicit(deduct.fDeducedArgs))
return false; return false;