mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 01:36:01 +02:00
Bug 438348 - Leave parameter pack of nested template intact when
substituting arguments to enclosing template Change-Id: I9c5fcca535bc4cecb05186fc498708159954a1a5 Signed-off-by: Nathan Ridge <zeratul976@hotmail.com> Reviewed-on: https://git.eclipse.org/r/31249 Tested-by: Hudson CI Reviewed-by: Sergey Prigogin <eclipse.sprigogin@gmail.com> Tested-by: Sergey Prigogin <eclipse.sprigogin@gmail.com>
This commit is contained in:
parent
15402f6488
commit
b65c120429
2 changed files with 19 additions and 3 deletions
|
@ -8031,6 +8031,22 @@ public class AST2TemplateTests extends AST2TestBase {
|
|||
parseAndCheckBindings();
|
||||
}
|
||||
|
||||
// template <typename = int>
|
||||
// struct S {
|
||||
// typedef int A;
|
||||
//
|
||||
// template <typename... Args>
|
||||
// void waldo(A, Args...);
|
||||
// };
|
||||
//
|
||||
// int main() {
|
||||
// S<> s;
|
||||
// s.waldo(0, 0); // ERROR HERE
|
||||
// }
|
||||
public void testParameterPackInNestedTemplate_441028() throws Exception {
|
||||
parseAndCheckBindings();
|
||||
}
|
||||
|
||||
// template <typename T>
|
||||
// struct A {};
|
||||
//
|
||||
|
|
|
@ -1148,8 +1148,8 @@ public class CPPTemplates {
|
|||
IType origType = types[i];
|
||||
IType newType;
|
||||
if (origType instanceof ICPPParameterPackType) {
|
||||
origType= ((ICPPParameterPackType) origType).getType();
|
||||
int packSize= determinePackSize(origType, tpMap);
|
||||
IType innerType= ((ICPPParameterPackType) origType).getType();
|
||||
int packSize= determinePackSize(innerType, tpMap);
|
||||
if (packSize == PACK_SIZE_FAIL || packSize == PACK_SIZE_NOT_FOUND) {
|
||||
newType= new ProblemBinding(point, IProblemBinding.SEMANTIC_INVALID_TYPE,
|
||||
types[i] instanceof IBinding ? ((IBinding) types[i]).getNameCharArray() : null);
|
||||
|
@ -1160,7 +1160,7 @@ public class CPPTemplates {
|
|||
System.arraycopy(result, 0, newResult, 0, j);
|
||||
result= newResult;
|
||||
for (int k= 0; k < packSize; k++) {
|
||||
result[j++]= instantiateType(origType, tpMap, k, within, point);
|
||||
result[j++]= instantiateType(innerType, tpMap, k, within, point);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue