mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-08 18:26:01 +02:00
Bug 401140 - NullPointerException in CPPTemplates.addDefaultArguments()
Change-Id: I05fa8a3935904cb1bd293348dcbf10810e677b5c Reviewed-on: https://git.eclipse.org/r/10466 Reviewed-by: Sergey Prigogin <eclipse.sprigogin@gmail.com> IP-Clean: Sergey Prigogin <eclipse.sprigogin@gmail.com> Tested-by: Sergey Prigogin <eclipse.sprigogin@gmail.com>
This commit is contained in:
parent
f1542b27c6
commit
ee08bee24b
2 changed files with 24 additions and 0 deletions
|
@ -7271,4 +7271,26 @@ public class AST2TemplateTests extends AST2TestBase {
|
||||||
public void testRegression_399829() throws Exception {
|
public void testRegression_399829() throws Exception {
|
||||||
parseAndCheckBindings();
|
parseAndCheckBindings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// template <typename>
|
||||||
|
// struct Bind {};
|
||||||
|
// template <typename Func, typename ... BoundArgs>
|
||||||
|
// struct Bind_helper {
|
||||||
|
// typedef Bind<Func(BoundArgs...)> type;
|
||||||
|
// };
|
||||||
|
// template <typename Func, typename ... BoundArgs>
|
||||||
|
// typename Bind_helper<Func, BoundArgs...>::type
|
||||||
|
// bind(Func, BoundArgs...);
|
||||||
|
// struct S {
|
||||||
|
// template <typename T, typename U>
|
||||||
|
// void operator()(T, U);
|
||||||
|
// };
|
||||||
|
// int main() {
|
||||||
|
// S s;
|
||||||
|
// bind(s, 0, foo);
|
||||||
|
// }
|
||||||
|
public void testNPE_401140() throws Exception {
|
||||||
|
BindingAssertionHelper helper = new BindingAssertionHelper(getAboveComment(), true);
|
||||||
|
helper.assertProblem("bind(s, 0, foo)", "bind");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1103,6 +1103,7 @@ public class CPPTemplates {
|
||||||
ICPPTemplateArgument origArg = args[i];
|
ICPPTemplateArgument origArg = args[i];
|
||||||
ICPPTemplateArgument newArg;
|
ICPPTemplateArgument newArg;
|
||||||
if (origArg.isPackExpansion()) {
|
if (origArg.isPackExpansion()) {
|
||||||
|
ICPPTemplateArgument unexpanded= origArg;
|
||||||
origArg= origArg.getExpansionPattern();
|
origArg= origArg.getExpansionPattern();
|
||||||
int packSize= determinePackSize(origArg, tpMap);
|
int packSize= determinePackSize(origArg, tpMap);
|
||||||
if (packSize == PACK_SIZE_FAIL || packSize == PACK_SIZE_NOT_FOUND) {
|
if (packSize == PACK_SIZE_FAIL || packSize == PACK_SIZE_NOT_FOUND) {
|
||||||
|
@ -1118,6 +1119,7 @@ public class CPPTemplates {
|
||||||
if (!isValidArgument(newArg)) {
|
if (!isValidArgument(newArg)) {
|
||||||
if (strict)
|
if (strict)
|
||||||
return null;
|
return null;
|
||||||
|
result[i + resultShift] = unexpanded;
|
||||||
newResult = result;
|
newResult = result;
|
||||||
shift = 0;
|
shift = 0;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Reference in a new issue