mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Fixed remaining case of infinite loop in template resolution.
This commit is contained in:
parent
d2bb462531
commit
d3477152cd
1 changed files with 8 additions and 0 deletions
|
@ -8,16 +8,19 @@
|
|||
* Contributors:
|
||||
* IBM Corporation - initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* Sergey Prigogin (Google)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.IProblemBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
import org.eclipse.cdt.core.dom.ast.ITypedef;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPScope;
|
||||
import org.eclipse.cdt.core.parser.util.ObjectMap;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.ProblemBinding;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPTemplates;
|
||||
|
||||
/**
|
||||
|
@ -45,6 +48,11 @@ public class CPPTypedefSpecialization extends CPPSpecialization implements IType
|
|||
public IType getType() throws DOMException {
|
||||
if (type == null) {
|
||||
type = CPPTemplates.instantiateType(getTypedef().getType(), argumentMap, getScope());
|
||||
if (type == this) {
|
||||
// A typedef pointing to itself is a sure recipe for an infinite loop.
|
||||
type = new ProblemBinding(getDefinition(), IProblemBinding.SEMANTIC_INVALID_TYPE,
|
||||
getNameCharArray());
|
||||
}
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue