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

Bug 333325: Default template arguments for function templates.

This commit is contained in:
Markus Schorn 2011-01-07 13:55:39 +00:00
parent e3fcf44ebd
commit 91c157b041
2 changed files with 24 additions and 8 deletions

View file

@ -5186,4 +5186,11 @@ public class AST2TemplateTests extends AST2BaseTest {
public void testNonTypeTemplateParameterWithTypenameKeyword_Bug333186() throws Exception {
parseAndCheckBindings();
}
// template <typename T, typename U = int> void f() {
// f<int>();
// }
public void testDefaultTmplArgumentOfFunctionTemplate_Bug333325() throws Exception {
parseAndCheckBindings();
}
}

View file

@ -111,9 +111,11 @@ public class TemplateArgumentDeduction {
result.addAll(Arrays.asList(deducedArgs));
} else {
ICPPTemplateArgument deducedArg= map.getArgument(tpar);
if (deducedArg == null)
return null;
if (deducedArg == null) {
deducedArg= tpar.getDefaultValue();
if (deducedArg == null)
return null;
}
result.add(deducedArg);
}
}
@ -192,8 +194,11 @@ public class TemplateArgumentDeduction {
result.addAll(Arrays.asList(deducedArgs));
} else {
ICPPTemplateArgument deducedArg= map.getArgument(tpar);
if (deducedArg == null)
return null;
if (deducedArg == null) {
deducedArg= tpar.getDefaultValue();
if (deducedArg == null)
return null;
}
result.add(deducedArg);
}
@ -224,9 +229,13 @@ public class TemplateArgumentDeduction {
for (int i = 0; i < length; i++) {
if (result[i] == null) {
ICPPTemplateArgument deducedArg= map.getArgument(tmplParams[i]);
if (deducedArg == null)
return null;
final ICPPTemplateParameter tpar = tmplParams[i];
ICPPTemplateArgument deducedArg= map.getArgument(tpar);
if (deducedArg == null) {
deducedArg= tpar.getDefaultValue();
if (deducedArg == null)
return null;
}
result[i]= deducedArg;
}
}