1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-07 17:56: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:
Nathan Ridge 2014-08-08 02:14:12 -04:00 committed by Sergey Prigogin
parent 15402f6488
commit b65c120429
2 changed files with 19 additions and 3 deletions

View file

@ -8031,6 +8031,22 @@ public class AST2TemplateTests extends AST2TestBase {
parseAndCheckBindings(); 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> // template <typename T>
// struct A {}; // struct A {};
// //

View file

@ -1148,8 +1148,8 @@ public class CPPTemplates {
IType origType = types[i]; IType origType = types[i];
IType newType; IType newType;
if (origType instanceof ICPPParameterPackType) { if (origType instanceof ICPPParameterPackType) {
origType= ((ICPPParameterPackType) origType).getType(); IType innerType= ((ICPPParameterPackType) origType).getType();
int packSize= determinePackSize(origType, tpMap); int packSize= determinePackSize(innerType, tpMap);
if (packSize == PACK_SIZE_FAIL || packSize == PACK_SIZE_NOT_FOUND) { if (packSize == PACK_SIZE_FAIL || packSize == PACK_SIZE_NOT_FOUND) {
newType= new ProblemBinding(point, IProblemBinding.SEMANTIC_INVALID_TYPE, newType= new ProblemBinding(point, IProblemBinding.SEMANTIC_INVALID_TYPE,
types[i] instanceof IBinding ? ((IBinding) types[i]).getNameCharArray() : null); types[i] instanceof IBinding ? ((IBinding) types[i]).getNameCharArray() : null);
@ -1160,7 +1160,7 @@ public class CPPTemplates {
System.arraycopy(result, 0, newResult, 0, j); System.arraycopy(result, 0, newResult, 0, j);
result= newResult; result= newResult;
for (int k= 0; k < packSize; k++) { for (int k= 0; k < packSize; k++) {
result[j++]= instantiateType(origType, tpMap, k, within, point); result[j++]= instantiateType(innerType, tpMap, k, within, point);
} }
continue; continue;
} }