mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-05 16:56:04 +02:00
Bug 434150 - Infinite recursion with decltype
This commit is contained in:
parent
2131d04278
commit
ae2d1154f9
2 changed files with 31 additions and 5 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2007, 2013 Symbian Software Systems and others.
|
* Copyright (c) 2007, 2014 Symbian Software Systems 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
|
||||||
|
@ -768,6 +768,18 @@ public abstract class IndexCPPBindingResolutionTest extends IndexBindingResoluti
|
||||||
assertQNEquals("n1::n2::Int", b12);
|
assertQNEquals("n1::n2::Int", b12);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// struct A {
|
||||||
|
// static struct {
|
||||||
|
// } waldo;
|
||||||
|
// };
|
||||||
|
// decltype(A::waldo) A::waldo;
|
||||||
|
|
||||||
|
// A a;
|
||||||
|
public void testDecltype_434150() throws Exception {
|
||||||
|
checkBindings();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// // header content
|
// // header content
|
||||||
// enum E { ER1, ER2 };
|
// enum E { ER1, ER2 };
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2004, 2011 IBM Corporation and others.
|
* Copyright (c) 2004, 2014 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
|
||||||
|
@ -9,6 +9,7 @@
|
||||||
* Andrew Niefer (IBM Corporation) - Initial API and implementation
|
* Andrew Niefer (IBM Corporation) - Initial API and implementation
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
* Ed Swartz (Nokia)
|
* Ed Swartz (Nokia)
|
||||||
|
* Sergey Prigogin (Google)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
|
@ -126,11 +127,24 @@ public class CPPVariable extends PlatformObject implements ICPPVariable, ICPPInt
|
||||||
if (fType != null) {
|
if (fType != null) {
|
||||||
return fType;
|
return fType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean doneWithDefinition = false;
|
||||||
IArrayType firstCandidate= null;
|
IArrayType firstCandidate= null;
|
||||||
final int length = fDeclarations == null ? 0 : fDeclarations.length;
|
final int length = fDeclarations == null ? 0 : fDeclarations.length;
|
||||||
for (int i = -1; i < length; i++) {
|
for (int i = 0; i <= length; i++) {
|
||||||
IASTName n = i == -1 ? fDefinition : fDeclarations[i];
|
IASTName n;
|
||||||
|
// Process the definition according to its relative position among the declarations.
|
||||||
|
// See http://bugs.eclipse.org/434150
|
||||||
|
if (fDefinition != null && !doneWithDefinition &&
|
||||||
|
(i == length || ((ASTNode) fDefinition).getOffset() < ((ASTNode) fDeclarations[i]).getOffset())) {
|
||||||
|
n = fDefinition;
|
||||||
|
doneWithDefinition = true;
|
||||||
|
--i; // We still have to come back to the declaration at position i.
|
||||||
|
} else if (i < length) {
|
||||||
|
n = fDeclarations[i];
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
if (n != null) {
|
if (n != null) {
|
||||||
while (n.getParent() instanceof IASTName)
|
while (n.getParent() instanceof IASTName)
|
||||||
n = (IASTName) n.getParent();
|
n = (IASTName) n.getParent();
|
||||||
|
|
Loading…
Add table
Reference in a new issue