diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPVariable.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPVariable.java index 69a016a62be..710efe2d940 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPVariable.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPVariable.java @@ -193,8 +193,19 @@ public class CPPVariable implements ICPPVariable, ICPPInternalBinding { */ public IType getType() { if( type == null ){ - IASTDeclarator dtor = (IASTDeclarator) ( (definition != null) ? definition.getParent() : declarations[0].getParent() ); - type = CPPVisitor.createType( dtor ); + IASTName n = null; + if( definition != null ) + n = definition; + else if( declarations != null && declarations.length > 0 ) + n = declarations[0]; + + if( n != null ){ + while( n.getParent() instanceof IASTName ) + n = (IASTName) n.getParent(); + IASTNode node = n.getParent(); + if( node instanceof IASTDeclarator ) + type = CPPVisitor.createType( (IASTDeclarator)node ); + } } return type; }