1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-09 10:46:02 +02:00

Instantiation of default template argument, bug 284683.

This commit is contained in:
Markus Schorn 2009-07-28 09:01:14 +00:00
parent 8805cff070
commit 3561a3e22b
2 changed files with 8 additions and 6 deletions

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2005, 2008 IBM Corporation and others. * Copyright (c) 2005, 2009 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -63,7 +63,7 @@ public class CPPTemplateNonTypeParameter extends CPPTemplateParameter implements
return null; return null;
IValue val= Value.create(d, Value.MAX_RECURSION_DEPTH); IValue val= Value.create(d, Value.MAX_RECURSION_DEPTH);
IType t= CPPVisitor.createType(d); IType t= getType();
return new CPPTemplateArgument(val, t); return new CPPTemplateArgument(val, t);
} }

View file

@ -930,11 +930,13 @@ public class CPPTemplates {
private static ICPPTemplateArgument instantiateArgument(ICPPTemplateArgument arg, private static ICPPTemplateArgument instantiateArgument(ICPPTemplateArgument arg,
ICPPTemplateParameterMap tpMap, ICPPClassSpecialization within) { ICPPTemplateParameterMap tpMap, ICPPClassSpecialization within) {
if (arg.isNonTypeValue()) { if (arg.isNonTypeValue()) {
final IValue orig= arg.getNonTypeValue(); final IValue origValue= arg.getNonTypeValue();
final IValue inst= instantiateValue(orig, tpMap, within, Value.MAX_RECURSION_DEPTH); final IType origType= arg.getTypeOfNonTypeValue();
if (orig == inst) final IValue instValue= instantiateValue(origValue, tpMap, within, Value.MAX_RECURSION_DEPTH);
final IType instType= instantiateType(origType, tpMap, within);
if (origType == instType && origValue == instValue)
return arg; return arg;
return new CPPTemplateArgument(inst, arg.getTypeOfNonTypeValue()); return new CPPTemplateArgument(instValue, instType);
} }
final IType orig= arg.getTypeValue(); final IType orig= arg.getTypeValue();